diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-05-24 11:04:22 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-05-24 11:28:24 -0400 |
commit | 30190c3c6181470203e6f635166496aa640ffe06 (patch) | |
tree | 7d2ea782fed9f713a33122c81a5210a9a11d350b /drivers/hwmon/nct6683.c | |
parent | e8cba3cda44e1b042a64ab43d15d4d77c2038235 (diff) |
hwmon: (nct6683) 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/nct6683.c')
-rw-r--r-- | drivers/hwmon/nct6683.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index 540c81c52344..7710f4694ba1 100644 --- a/drivers/hwmon/nct6683.c +++ b/drivers/hwmon/nct6683.c | |||
@@ -1389,7 +1389,7 @@ static int __init sensors_nct6683_init(void) | |||
1389 | pdev[i] = platform_device_alloc(DRVNAME, address); | 1389 | pdev[i] = platform_device_alloc(DRVNAME, address); |
1390 | if (!pdev[i]) { | 1390 | if (!pdev[i]) { |
1391 | err = -ENOMEM; | 1391 | err = -ENOMEM; |
1392 | goto exit_device_put; | 1392 | goto exit_device_unregister; |
1393 | } | 1393 | } |
1394 | 1394 | ||
1395 | err = platform_device_add_data(pdev[i], &sio_data, | 1395 | err = platform_device_add_data(pdev[i], &sio_data, |
@@ -1427,9 +1427,11 @@ static int __init sensors_nct6683_init(void) | |||
1427 | return 0; | 1427 | return 0; |
1428 | 1428 | ||
1429 | exit_device_put: | 1429 | exit_device_put: |
1430 | for (i = 0; i < ARRAY_SIZE(pdev); i++) { | 1430 | platform_device_put(pdev[i]); |
1431 | exit_device_unregister: | ||
1432 | while (--i >= 0) { | ||
1431 | if (pdev[i]) | 1433 | if (pdev[i]) |
1432 | platform_device_put(pdev[i]); | 1434 | platform_device_unregister(pdev[i]); |
1433 | } | 1435 | } |
1434 | exit_unregister: | 1436 | exit_unregister: |
1435 | platform_driver_unregister(&nct6683_driver); | 1437 | platform_driver_unregister(&nct6683_driver); |