Skip to contentSkip to conversation

zorro: fix device_register() error handling

PATCH Applied Vasiliy Kulikov 2 participants 2 messages Sep 19, 2010 – Sep 30, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 14/14 zorro: 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/zorro/zorro.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/zorro/zorro.c +2 -0
index 6455f3a..e0c2807 100644
@@ -142,6 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 	error = device_register(&bus->dev);
 	if (error) {
 		pr_err("Zorro: Error registering zorro_bus\n");
+		put_device(&bus->dev);
 		kfree(bus);
 		return error;
 	}
@@ -175,6 +176,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 		if (error) {
 			dev_err(&bus->dev, "Error registering device %s\n",
 				z->name);
+			put_device(&z->dev);
 			continue;
 		}
 		error = zorro_create_sysfs_dev_files(z);
Signature · 1 line
1.7.0.4
maintainer Applied
#1 lore raw
Quoted 4 lines · Vasiliy Kulikov

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

Thanks, applied to m68k tree, queued for 2.6.37.

Quoted 27 lines

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

 drivers/zorro/zorro.c |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/zorro/zorro.c +2 -1
index 6455f3a..e0c2807 100644
@@ -142,6 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
        error = device_register(&bus->dev);
        if (error) {
                pr_err("Zorro: Error registering zorro_bus\n");
+               put_device(&bus->dev);
                kfree(bus);
                return error;
        }
@@ -175,6 +176,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
                if (error) {
                        dev_err(&bus->dev, "Error registering device %s\n",
                                z->name);
+                       put_device(&z->dev);
                        continue;
                }
                error = zorro_create_sysfs_dev_files(z);
--
Quoted 1 line

1.7.0.4

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds