diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 12:58:05 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-09-24 00:08:31 -0400 |
commit | 33cd66e3c8048f03b9cc107b7a21c29cfd700ab7 (patch) | |
tree | bf6db4c592c7b25f51a47181806205a335eaa1c5 /drivers/hwmon/f71882fg.c | |
parent | 59da32d8dfd991fedc0bad197fb6f6a79bb9e712 (diff) |
hwmon: (f71882fg) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r-- | drivers/hwmon/f71882fg.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index dd5ae567bf92..50e4ce2d22d8 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -2274,7 +2274,8 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2274 | int err, i; | 2274 | int err, i; |
2275 | u8 start_reg, reg; | 2275 | u8 start_reg, reg; |
2276 | 2276 | ||
2277 | data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); | 2277 | data = devm_kzalloc(&pdev->dev, sizeof(struct f71882fg_data), |
2278 | GFP_KERNEL); | ||
2278 | if (!data) | 2279 | if (!data) |
2279 | return -ENOMEM; | 2280 | return -ENOMEM; |
2280 | 2281 | ||
@@ -2288,13 +2289,11 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2288 | start_reg = f71882fg_read8(data, F71882FG_REG_START); | 2289 | start_reg = f71882fg_read8(data, F71882FG_REG_START); |
2289 | if (start_reg & 0x04) { | 2290 | if (start_reg & 0x04) { |
2290 | dev_warn(&pdev->dev, "Hardware monitor is powered down\n"); | 2291 | dev_warn(&pdev->dev, "Hardware monitor is powered down\n"); |
2291 | err = -ENODEV; | 2292 | return -ENODEV; |
2292 | goto exit_free; | ||
2293 | } | 2293 | } |
2294 | if (!(start_reg & 0x03)) { | 2294 | if (!(start_reg & 0x03)) { |
2295 | dev_warn(&pdev->dev, "Hardware monitoring not activated\n"); | 2295 | dev_warn(&pdev->dev, "Hardware monitoring not activated\n"); |
2296 | err = -ENODEV; | 2296 | return -ENODEV; |
2297 | goto exit_free; | ||
2298 | } | 2297 | } |
2299 | 2298 | ||
2300 | /* Register sysfs interface files */ | 2299 | /* Register sysfs interface files */ |
@@ -2422,8 +2421,6 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2422 | exit_unregister_sysfs: | 2421 | exit_unregister_sysfs: |
2423 | f71882fg_remove(pdev); /* Will unregister the sysfs files for us */ | 2422 | f71882fg_remove(pdev); /* Will unregister the sysfs files for us */ |
2424 | return err; /* f71882fg_remove() also frees our data */ | 2423 | return err; /* f71882fg_remove() also frees our data */ |
2425 | exit_free: | ||
2426 | kfree(data); | ||
2427 | return err; | 2424 | return err; |
2428 | } | 2425 | } |
2429 | 2426 | ||
@@ -2525,10 +2522,6 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2525 | ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); | 2522 | ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); |
2526 | } | 2523 | } |
2527 | } | 2524 | } |
2528 | |||
2529 | platform_set_drvdata(pdev, NULL); | ||
2530 | kfree(data); | ||
2531 | |||
2532 | return 0; | 2525 | return 0; |
2533 | } | 2526 | } |
2534 | 2527 | ||