Commit 5bb7889f authored by Levente Kurusa's avatar Levente Kurusa Committed by Ralf Baechle

TC: Handle device_register() errors.

Make the TURBOchannel driver bail out if the call to device_register()
failed.
Signed-off-by: default avatarLevente Kurusa <levex@linux.com>
Acked-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: Linux MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6673/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent ab6c15bc
...@@ -129,7 +129,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) ...@@ -129,7 +129,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)
tc_device_get_irq(tdev); tc_device_get_irq(tdev);
device_register(&tdev->dev); if (device_register(&tdev->dev)) {
put_device(&tdev->dev);
goto out_err;
}
list_add_tail(&tdev->node, &tbus->devices); list_add_tail(&tdev->node, &tbus->devices);
out_err: out_err:
...@@ -148,7 +151,10 @@ static int __init tc_init(void) ...@@ -148,7 +151,10 @@ static int __init tc_init(void)
INIT_LIST_HEAD(&tc_bus.devices); INIT_LIST_HEAD(&tc_bus.devices);
dev_set_name(&tc_bus.dev, "tc"); dev_set_name(&tc_bus.dev, "tc");
device_register(&tc_bus.dev); if (device_register(&tc_bus.dev)) {
put_device(&tc_bus.dev);
return 0;
}
if (tc_bus.info.slot_size) { if (tc_bus.info.slot_size) {
unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000;
......
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