If device_register() fails then call put_device().
See comment to device_register.
Signed-off-by: Vasiliy Kulikov <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
error = device_register(&bus->dev);
if (error) {
pr_err("Zorro: Error registering zorro_bus\n");
+ put_device(&bus->dev);
kfree(bus);
return error;
}
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);