Commit 33cd66e3 authored by Guenter Roeck's avatar Guenter Roeck

hwmon: (f71882fg) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 59da32d8
...@@ -2274,7 +2274,8 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) ...@@ -2274,7 +2274,8 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
int err, i; int err, i;
u8 start_reg, reg; u8 start_reg, reg;
data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(struct f71882fg_data),
GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
...@@ -2288,13 +2289,11 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) ...@@ -2288,13 +2289,11 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
start_reg = f71882fg_read8(data, F71882FG_REG_START); start_reg = f71882fg_read8(data, F71882FG_REG_START);
if (start_reg & 0x04) { if (start_reg & 0x04) {
dev_warn(&pdev->dev, "Hardware monitor is powered down\n"); dev_warn(&pdev->dev, "Hardware monitor is powered down\n");
err = -ENODEV; return -ENODEV;
goto exit_free;
} }
if (!(start_reg & 0x03)) { if (!(start_reg & 0x03)) {
dev_warn(&pdev->dev, "Hardware monitoring not activated\n"); dev_warn(&pdev->dev, "Hardware monitoring not activated\n");
err = -ENODEV; return -ENODEV;
goto exit_free;
} }
/* Register sysfs interface files */ /* Register sysfs interface files */
...@@ -2422,8 +2421,6 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) ...@@ -2422,8 +2421,6 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
exit_unregister_sysfs: exit_unregister_sysfs:
f71882fg_remove(pdev); /* Will unregister the sysfs files for us */ f71882fg_remove(pdev); /* Will unregister the sysfs files for us */
return err; /* f71882fg_remove() also frees our data */ return err; /* f71882fg_remove() also frees our data */
exit_free:
kfree(data);
return err; return err;
} }
...@@ -2525,10 +2522,6 @@ static int f71882fg_remove(struct platform_device *pdev) ...@@ -2525,10 +2522,6 @@ static int f71882fg_remove(struct platform_device *pdev)
ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans);
} }
} }
platform_set_drvdata(pdev, NULL);
kfree(data);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment