diff options
Diffstat (limited to 'drivers/pcmcia/i82365.c')
-rw-r--r-- | drivers/pcmcia/i82365.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 32a2ab119798..68f6b2702bc4 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -1263,7 +1263,7 @@ static int __init init_i82365(void) | |||
1263 | 1263 | ||
1264 | ret = driver_register(&i82365_driver); | 1264 | ret = driver_register(&i82365_driver); |
1265 | if (ret) | 1265 | if (ret) |
1266 | return ret; | 1266 | goto err_out; |
1267 | 1267 | ||
1268 | i82365_device = platform_device_alloc("i82365", 0); | 1268 | i82365_device = platform_device_alloc("i82365", 0); |
1269 | if (i82365_device) { | 1269 | if (i82365_device) { |
@@ -1273,10 +1273,8 @@ static int __init init_i82365(void) | |||
1273 | } else | 1273 | } else |
1274 | ret = -ENOMEM; | 1274 | ret = -ENOMEM; |
1275 | 1275 | ||
1276 | if (ret) { | 1276 | if (ret) |
1277 | driver_unregister(&i82365_driver); | 1277 | goto err_driver_unregister; |
1278 | return ret; | ||
1279 | } | ||
1280 | 1278 | ||
1281 | printk(KERN_INFO "Intel ISA PCIC probe: "); | 1279 | printk(KERN_INFO "Intel ISA PCIC probe: "); |
1282 | sockets = 0; | 1280 | sockets = 0; |
@@ -1285,16 +1283,17 @@ static int __init init_i82365(void) | |||
1285 | 1283 | ||
1286 | if (sockets == 0) { | 1284 | if (sockets == 0) { |
1287 | printk("not found.\n"); | 1285 | printk("not found.\n"); |
1288 | platform_device_unregister(i82365_device); | 1286 | ret = -ENODEV; |
1289 | release_region(i365_base, 2); | 1287 | goto err_dev_unregister; |
1290 | driver_unregister(&i82365_driver); | ||
1291 | return -ENODEV; | ||
1292 | } | 1288 | } |
1293 | 1289 | ||
1294 | /* Set up interrupt handler(s) */ | 1290 | /* Set up interrupt handler(s) */ |
1295 | if (grab_irq != 0) | 1291 | if (grab_irq != 0) |
1296 | request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); | 1292 | ret = request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt); |
1297 | 1293 | ||
1294 | if (ret) | ||
1295 | goto err_socket_release; | ||
1296 | |||
1298 | /* register sockets with the pcmcia core */ | 1297 | /* register sockets with the pcmcia core */ |
1299 | for (i = 0; i < sockets; i++) { | 1298 | for (i = 0; i < sockets; i++) { |
1300 | socket[i].socket.dev.parent = &i82365_device->dev; | 1299 | socket[i].socket.dev.parent = &i82365_device->dev; |
@@ -1324,7 +1323,23 @@ static int __init init_i82365(void) | |||
1324 | } | 1323 | } |
1325 | 1324 | ||
1326 | return 0; | 1325 | return 0; |
1327 | 1326 | err_socket_release: | |
1327 | for (i = 0; i < sockets; i++) { | ||
1328 | /* Turn off all interrupt sources! */ | ||
1329 | i365_set(i, I365_CSCINT, 0); | ||
1330 | release_region(socket[i].ioaddr, 2); | ||
1331 | } | ||
1332 | err_dev_unregister: | ||
1333 | platform_device_unregister(i82365_device); | ||
1334 | release_region(i365_base, 2); | ||
1335 | #ifdef CONFIG_PNP | ||
1336 | if (i82365_pnpdev) | ||
1337 | pnp_disable_dev(i82365_pnpdev); | ||
1338 | #endif | ||
1339 | err_driver_unregister: | ||
1340 | driver_unregister(&i82365_driver); | ||
1341 | err_out: | ||
1342 | return ret; | ||
1328 | } /* init_i82365 */ | 1343 | } /* init_i82365 */ |
1329 | 1344 | ||
1330 | static void __exit exit_i82365(void) | 1345 | static void __exit exit_i82365(void) |