Commit 8d6d3943 authored by Herbert Xu's avatar Herbert Xu Committed by Linus Torvalds

[PATCH] Check return status of register calls in i82365

i82365 calls driver_register and platform_device_register without checking
their return values.  This patch fixes that.

It also runs platform_device_register() prior to isa_probe() so we don't have
to undo ise_probe()'s effects if platform_device_register() ends up failing.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8783a1ce
...@@ -1372,8 +1372,15 @@ static int __init init_i82365(void) ...@@ -1372,8 +1372,15 @@ static int __init init_i82365(void)
{ {
int i, ret; int i, ret;
if (driver_register(&i82365_driver)) ret = driver_register(&i82365_driver);
return -1; if (ret)
return ret;
ret = platform_device_register(&i82365_device);
if (ret) {
driver_unregister(&i82365_driver);
return ret;
}
printk(KERN_INFO "Intel ISA PCIC probe: "); printk(KERN_INFO "Intel ISA PCIC probe: ");
sockets = 0; sockets = 0;
...@@ -1382,12 +1389,11 @@ static int __init init_i82365(void) ...@@ -1382,12 +1389,11 @@ static int __init init_i82365(void)
if (sockets == 0) { if (sockets == 0) {
printk("not found.\n"); printk("not found.\n");
platform_device_unregister(&i82365_device);
driver_unregister(&i82365_driver); driver_unregister(&i82365_driver);
return -ENODEV; return -ENODEV;
} }
platform_device_register(&i82365_device);
/* Set up interrupt handler(s) */ /* Set up interrupt handler(s) */
if (grab_irq != 0) if (grab_irq != 0)
request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt);
......
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