From: "Om Narasimhan" The previous code did something like, if (error) goto out_err; .... do { struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); del_timer_sync(&skt->poll_timer); pcmcia_unregister_socket(&skt->socket); out_err: flush_scheduled_work(); ops->hw_shutdown(skt); i--; } while (i > 0) ..... - On the error path, skt would not contain a valid value for the first iteration (skt is masked by uninitialized automatic skt) - Does not do hw_shutdown() for 0th element of PCMCIA_SOCKET Signed-off-by: Om Narasimhan Cc: Dominik Brodowski Signed-off-by: Andrew Morton --- drivers/pcmcia/au1000_generic.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff -puN drivers/pcmcia/au1000_generic.c~pcmcia-au1000_generic-fix drivers/pcmcia/au1000_generic.c --- a/drivers/pcmcia/au1000_generic.c~pcmcia-au1000_generic-fix +++ a/drivers/pcmcia/au1000_generic.c @@ -4,7 +4,7 @@ * * Copyright 2001-2003 MontaVista Software Inc. * Author: MontaVista Software, Inc. - * ppopov@embeddedalley.com or source@mvista.com + * ppopov@embeddedalley.com or source@mvista.com * * Copyright 2004 Pete Popov, Embedded Alley Solutions, Inc. * Updated the driver to 2.6. Followed the sa11xx API and largely @@ -438,17 +438,16 @@ int au1x00_pcmcia_socket_probe(struct de dev_set_drvdata(dev, sinfo); return 0; - do { +out_err: + flush_scheduled_work(); + ops->hw_shutdown(skt); + while (i-- > 0) { struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); - del_timer_sync(&skt->poll_timer); pcmcia_unregister_socket(&skt->socket); -out_err: flush_scheduled_work(); ops->hw_shutdown(skt); - - i--; - } while (i > 0); + } kfree(sinfo); out: return ret; _