]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCMCIA: fix sa1111 oops on remove
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 24 Jan 2012 21:33:26 +0000 (21:33 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 24 Jan 2012 21:33:26 +0000 (21:33 +0000)
The sa1111 socket driver oopses when removed:

Unable to handle kernel NULL pointer dereference at virtual address 000003b0
pgd = c1b40000
[000003b0] *pgd=00000000
Internal error: Oops: 41b43005 [#1]
Modules linked in:
CPU: 0    Not tainted  (3.3.0-rc1+ #744)
PC is at pcmcia_remove+0x3c/0x60
LR is at pcmcia_remove+0x34/0x60

This is because we try to dereference a NULL 's' to obtain the next
pointer.  Fix this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/pcmcia/sa1111_generic.c

index 59866905ea37e5f2150221506cf9bac73b2eaa6d..27f2fe3b7fb4a5e41a44a03fa75e2becce0d63d7 100644 (file)
@@ -205,7 +205,8 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev)
 
        dev_set_drvdata(&dev->dev, NULL);
 
-       for (; next = s->next, s; s = next) {
+       for (; s; s = next) {
+               next = s->next;
                soc_pcmcia_remove_one(&s->soc);
                kfree(s);
        }