Skip to content

Commit

Permalink
hwmon: (nct6775) Fix probe unwind paths to properly unregister platfo…
Browse files Browse the repository at this point in the history
…rm devices

Call platform_device_unregister() rather than platform_device_put() to
unregister successfully registered platform devices.

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
AxelLin authored and groeck committed May 24, 2014
1 parent 30190c3 commit 9d311ed
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/hwmon/nct6775.c
Original file line number Diff line number Diff line change
Expand Up @@ -4160,7 +4160,7 @@ static int __init sensors_nct6775_init(void)
pdev[i] = platform_device_alloc(DRVNAME, address);
if (!pdev[i]) {
err = -ENOMEM;
goto exit_device_put;
goto exit_device_unregister;
}

err = platform_device_add_data(pdev[i], &sio_data,
Expand Down Expand Up @@ -4198,9 +4198,11 @@ static int __init sensors_nct6775_init(void)
return 0;

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])
platform_device_put(pdev[i]);
platform_device_unregister(pdev[i]);
}
exit_unregister:
platform_driver_unregister(&nct6775_driver);
Expand Down

0 comments on commit 9d311ed

Please sign in to comment.