aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-05-24 11:21:23 -0400
committerGuenter Roeck <linux@roeck-us.net>2014-05-24 11:30:29 -0400
commit9d311eddf3565ed0e05b3cb5a22db41fa74d9d86 (patch)
treeffd5f8cb949f8b1c347f93589cad4b295cea8f38 /drivers/hwmon
parent30190c3c6181470203e6f635166496aa640ffe06 (diff)
hwmon: (nct6775) Fix probe unwind paths to properly unregister platform devices
Call platform_device_unregister() rather than platform_device_put() to unregister successfully registered platform devices. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/nct6775.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 38d5a6334053..59d9a3fc96b7 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -4160,7 +4160,7 @@ static int __init sensors_nct6775_init(void)
4160 pdev[i] = platform_device_alloc(DRVNAME, address); 4160 pdev[i] = platform_device_alloc(DRVNAME, address);
4161 if (!pdev[i]) { 4161 if (!pdev[i]) {
4162 err = -ENOMEM; 4162 err = -ENOMEM;
4163 goto exit_device_put; 4163 goto exit_device_unregister;
4164 } 4164 }
4165 4165
4166 err = platform_device_add_data(pdev[i], &sio_data, 4166 err = platform_device_add_data(pdev[i], &sio_data,
@@ -4198,9 +4198,11 @@ static int __init sensors_nct6775_init(void)
4198 return 0; 4198 return 0;
4199 4199
4200exit_device_put: 4200exit_device_put:
4201 for (i = 0; i < ARRAY_SIZE(pdev); i++) { 4201 platform_device_put(pdev[i]);
4202exit_device_unregister:
4203 while (--i >= 0) {
4202 if (pdev[i]) 4204 if (pdev[i])
4203 platform_device_put(pdev[i]); 4205 platform_device_unregister(pdev[i]);
4204 } 4206 }
4205exit_unregister: 4207exit_unregister:
4206 platform_driver_unregister(&nct6775_driver); 4208 platform_driver_unregister(&nct6775_driver);