Commit 10b68799 authored by Vasiliy Kulikov's avatar Vasiliy Kulikov Committed by Geert Uytterhoeven

zorro: Fix device_register() error handling

If device_register() fails then call put_device().
See comment to device_register.
Signed-off-by: default avatarVasiliy Kulikov <segooon@gmail.com>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 0c37dd7c
...@@ -142,6 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) ...@@ -142,6 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
error = device_register(&bus->dev); error = device_register(&bus->dev);
if (error) { if (error) {
pr_err("Zorro: Error registering zorro_bus\n"); pr_err("Zorro: Error registering zorro_bus\n");
put_device(&bus->dev);
kfree(bus); kfree(bus);
return error; return error;
} }
...@@ -175,6 +176,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) ...@@ -175,6 +176,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
if (error) { if (error) {
dev_err(&bus->dev, "Error registering device %s\n", dev_err(&bus->dev, "Error registering device %s\n",
z->name); z->name);
put_device(&z->dev);
continue; continue;
} }
error = zorro_create_sysfs_dev_files(z); error = zorro_create_sysfs_dev_files(z);
......
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