Skip to contentSkip to conversation

hwmon: (nct6775) Fix probe unwind paths to properly unregister platform devices

PATCH Applied Axel Lin 2 participants 2 messages May 24, 2014 Hardware monitoring

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/hwmon/nct6775.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/hwmon/nct6775.c +5 -3
index 38d5a63..59d9a3f 100644
@@ -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,
@@ -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);
Signature · 9 lines
1.8.3.2




_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
maintainer Applied
#1 lore raw

Re: [lm-sensors] [PATCH] hwmon: (nct6775) Fix probe unwind paths to properly unregister platform dev

Quoted 4 lines · Axel Lin

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

Applied to -next, thanks.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors