Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

zorro: Fix device_register() error handling

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>

authored by

Vasiliy Kulikov and committed by
Geert Uytterhoeven
10b68799 0c37dd7c

+2
+2
drivers/zorro/zorro.c
··· 142 142 error = device_register(&bus->dev); 143 143 if (error) { 144 144 pr_err("Zorro: Error registering zorro_bus\n"); 145 + put_device(&bus->dev); 145 146 kfree(bus); 146 147 return error; 147 148 } ··· 176 175 if (error) { 177 176 dev_err(&bus->dev, "Error registering device %s\n", 178 177 z->name); 178 + put_device(&z->dev); 179 179 continue; 180 180 } 181 181 error = zorro_create_sysfs_dev_files(z);