Commit 5dc0ff31 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: i82365 registration failure fixup

Fix a bug which was diagnosed by David Howard <daveh@dmh2000.com>.

The pseudo-unregistration of PCMCIA sockets in case the registration of any
such socket failed causes lockups.

See http://bugme.osdl.org/show_bug.cgi?id=4115 for details
Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 088f7c01
...@@ -208,6 +208,7 @@ typedef enum pcic_id { ...@@ -208,6 +208,7 @@ typedef enum pcic_id {
#define IS_UNKNOWN 0x0400 #define IS_UNKNOWN 0x0400
#define IS_VG_PWR 0x0800 #define IS_VG_PWR 0x0800
#define IS_DF_PWR 0x1000 #define IS_DF_PWR 0x1000
#define IS_REGISTERED 0x2000
#define IS_ALIVE 0x8000 #define IS_ALIVE 0x8000
typedef struct pcic_t { typedef struct pcic_t {
...@@ -1403,12 +1404,10 @@ static int __init init_i82365(void) ...@@ -1403,12 +1404,10 @@ static int __init init_i82365(void)
socket[i].socket.resource_ops = &pccard_nonstatic_ops; socket[i].socket.resource_ops = &pccard_nonstatic_ops;
socket[i].socket.owner = THIS_MODULE; socket[i].socket.owner = THIS_MODULE;
socket[i].number = i; socket[i].number = i;
ret = pcmcia_register_socket(&socket[i].socket); ret = pcmcia_register_socket(&socket[i].socket);
if (ret && i--) { if (!ret)
for (; i>= 0; i--) socket[i].flags |= IS_REGISTERED;
pcmcia_unregister_socket(&socket[i].socket);
break;
}
#if 0 /* driver model ordering issue */ #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_attr_info);
...@@ -1435,7 +1434,8 @@ static void __exit exit_i82365(void) ...@@ -1435,7 +1434,8 @@ static void __exit exit_i82365(void)
int i; int i;
for (i = 0; i < sockets; i++) { for (i = 0; i < sockets; i++) {
pcmcia_unregister_socket(&socket[i].socket); if (socket[i].flags & IS_REGISTERED)
pcmcia_unregister_socket(&socket[i].socket);
} }
platform_device_unregister(&i82365_device); platform_device_unregister(&i82365_device);
if (poll_interval != 0) if (poll_interval != 0)
......
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