Skip to contentSkip to conversation

dio: fix device_register() error handling

PATCH Applied Vasiliy Kulikov 1 participant 1 message Sep 19, 2010 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 2/14 dio: fix device_register() error handling

If device_register() fails then call put_device(). See comment to device_register.

---
I cannot compile this driver, so it is not tested at all.

 drivers/dio/dio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/dio/dio.c +2 -0
index 55dd88d..d2ede72 100644
@@ -186,6 +186,7 @@ static int __init dio_init(void)
 	error = device_register(&dio_bus.dev);
 	if (error) {
 		pr_err("DIO: Error registering dio_bus\n");
+		put_device(&dio_bus.dev);
 		return error;
 	}
 
@@ -261,6 +262,7 @@ static int __init dio_init(void)
 		if (error) {
 			pr_err("DIO: Error registering device %s\n",
 			       dev->name);
+			put_device(&dev->dev);
 			continue;
 		}
 		error = dio_create_sysfs_dev_files(dev);
Signature · 1 line
1.7.0.4