Skip to content

Commit

Permalink
zorro: Fix device_register() error handling
Browse files Browse the repository at this point in the history
If device_register() fails then call put_device().
See comment to device_register.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
  • Loading branch information
Vasiliy Kulikov authored and Geert Uytterhoeven committed Oct 22, 2010
1 parent 0c37dd7 commit 10b6879
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/zorro/zorro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 10b6879

Please sign in to comment.