提交 79d7f4ee 编写于 作者: B Baruch Siach 提交者: Linus Torvalds

gpio: pl061: fix probe error handling code

Note that IRQ has not been initialized when kmalloc() fails.

Also, use DECLARE_BITMAP() to make the code clearer.
Signed-off-by: NBaruch Siach <baruch@tkos.co.il>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 66918dcd
...@@ -221,7 +221,7 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id) ...@@ -221,7 +221,7 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
struct pl061_gpio *chip; struct pl061_gpio *chip;
struct list_head *chip_list; struct list_head *chip_list;
int ret, irq, i; 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; pdata = dev->dev.platform_data;
if (pdata == NULL) if (pdata == NULL)
...@@ -280,6 +280,7 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id) ...@@ -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? */ if (!test_and_set_bit(irq, init_irq)) { /* list initialized? */
chip_list = kmalloc(sizeof(*chip_list), GFP_KERNEL); chip_list = kmalloc(sizeof(*chip_list), GFP_KERNEL);
if (chip_list == NULL) { if (chip_list == NULL) {
clear_bit(irq, init_irq);
ret = -ENOMEM; ret = -ENOMEM;
goto iounmap; goto iounmap;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册