Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: max7300: use devm_kzalloc()

Use devm_kzalloc() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Jingoo Han and committed by
Linus Walleij
c3fe2bf4 24bb3813

+1 -3
+1 -3
drivers/gpio/gpio-max7300.c
··· 41 41 I2C_FUNC_SMBUS_BYTE_DATA)) 42 42 return -EIO; 43 43 44 - ts = kzalloc(sizeof(struct max7301), GFP_KERNEL); 44 + ts = devm_kzalloc(&client->dev, sizeof(struct max7301), GFP_KERNEL); 45 45 if (!ts) 46 46 return -ENOMEM; 47 47 ··· 50 50 ts->dev = &client->dev; 51 51 52 52 ret = __max730x_probe(ts); 53 - if (ret) 54 - kfree(ts); 55 53 return ret; 56 54 } 57 55