Skip to content

Commit

Permalink
gpio: pl061: fix probe error handling code
Browse files Browse the repository at this point in the history
Note that IRQ has not been initialized when kmalloc() fails.

Also, use DECLARE_BITMAP() to make the code clearer.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Baruch Siach authored and Linus Torvalds committed Jul 1, 2009
1 parent 66918dc commit 79d7f4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpio/pl061.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
struct pl061_gpio *chip;
struct list_head *chip_list;
int ret, irq, i;
static unsigned long init_irq[BITS_TO_LONGS(NR_IRQS)];
static DECLARE_BITMAP(init_irq, NR_IRQS);

pdata = dev->dev.platform_data;
if (pdata == NULL)
Expand Down Expand Up @@ -280,6 +280,7 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
if (!test_and_set_bit(irq, init_irq)) { /* list initialized? */
chip_list = kmalloc(sizeof(*chip_list), GFP_KERNEL);
if (chip_list == NULL) {
clear_bit(irq, init_irq);
ret = -ENOMEM;
goto iounmap;
}
Expand Down

0 comments on commit 79d7f4e

Please sign in to comment.