From: Guenter Roeck Date: Sat, 2 Jun 2012 16:57:57 +0000 (-0700) Subject: hwmon: (abituguru3) Convert to use devm_ functions X-Git-Tag: next-20120914~85^2~53 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=20fa6b30f7b30313ad51ecb22da6341c84895e01;p=karo-tx-linux.git hwmon: (abituguru3) Convert to use devm_ functions Convert to use devm_ functions to reduce code size and simplify the code. Cc: Hans de Goede Cc: Alistair John Strachan Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index 5d582aebff87..b174b8b2b4df 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c @@ -976,7 +976,8 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) u8 buf[2]; u16 id; - data = kzalloc(sizeof(struct abituguru3_data), GFP_KERNEL); + data = devm_kzalloc(&pdev->dev, sizeof(struct abituguru3_data), + GFP_KERNEL); if (!data) return -ENOMEM; @@ -1068,7 +1069,6 @@ abituguru3_probe_error: for (i = 0; i < ARRAY_SIZE(abituguru3_sysfs_attr); i++) device_remove_file(&pdev->dev, &abituguru3_sysfs_attr[i].dev_attr); - kfree(data); return res; } @@ -1084,8 +1084,6 @@ static int __devexit abituguru3_remove(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(abituguru3_sysfs_attr); i++) device_remove_file(&pdev->dev, &abituguru3_sysfs_attr[i].dev_attr); - kfree(data); - return 0; }