Commit 30190c3c authored by Axel Lin's avatar Axel Lin Committed by Guenter Roeck

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: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent e8cba3cd
...@@ -1389,7 +1389,7 @@ static int __init sensors_nct6683_init(void) ...@@ -1389,7 +1389,7 @@ static int __init sensors_nct6683_init(void)
pdev[i] = platform_device_alloc(DRVNAME, address); pdev[i] = platform_device_alloc(DRVNAME, address);
if (!pdev[i]) { if (!pdev[i]) {
err = -ENOMEM; err = -ENOMEM;
goto exit_device_put; goto exit_device_unregister;
} }
err = platform_device_add_data(pdev[i], &sio_data, err = platform_device_add_data(pdev[i], &sio_data,
...@@ -1427,9 +1427,11 @@ static int __init sensors_nct6683_init(void) ...@@ -1427,9 +1427,11 @@ static int __init sensors_nct6683_init(void)
return 0; return 0;
exit_device_put: exit_device_put:
for (i = 0; i < ARRAY_SIZE(pdev); i++) { platform_device_put(pdev[i]);
exit_device_unregister:
while (--i >= 0) {
if (pdev[i]) if (pdev[i])
platform_device_put(pdev[i]); platform_device_unregister(pdev[i]);
} }
exit_unregister: exit_unregister:
platform_driver_unregister(&nct6683_driver); platform_driver_unregister(&nct6683_driver);
......
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