In http://bugme.osdl.org/show_bug.cgi?id=4115, notes that init_i82365() will go into an infinite loop if registration of the zeroeth socket fails. This is due to some contorted recovery logic. Signed-off-by: Andrew Morton --- 25-akpm/drivers/pcmcia/i82365.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff -puN drivers/pcmcia/i82365.c~init_i82365-lockup-fix drivers/pcmcia/i82365.c --- 25/drivers/pcmcia/i82365.c~init_i82365-lockup-fix Thu Jan 27 14:10:40 2005 +++ 25-akpm/drivers/pcmcia/i82365.c Thu Jan 27 16:05:09 2005 @@ -1404,15 +1404,19 @@ static int __init init_i82365(void) socket[i].socket.owner = THIS_MODULE; socket[i].number = i; ret = pcmcia_register_socket(&socket[i].socket); - if (ret && i--) { - for (; i>= 0; i--) + if (ret) { + /* + * If registration of any socket failed, unregister all of + * them. + */ + while (--i >= 0) pcmcia_unregister_socket(&socket[i].socket); break; } #if 0 /* driver model ordering issue */ - class_device_create_file(&socket[i].socket.dev, + class_device_create_file(&socket[i].socket.dev, &class_device_attr_info); - class_device_create_file(&socket[i].socket.dev, + class_device_create_file(&socket[i].socket.dev, &class_device_attr_exca); #endif } _