mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 17:01:14 +00:00
[POWERPC] Avoid NULL pointer in gpio1_interrupt
gpio1_interrupt() may dereference a NULL pointer if ioremap() fails. But, maybe no gpio interrupt happens in the first place? Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
a8ed4f7ec3
commit
61e37ca22b
1 changed files with 6 additions and 1 deletions
|
@ -336,8 +336,10 @@ int __init find_via_pmu(void)
|
||||||
if (gaddr != OF_BAD_ADDR)
|
if (gaddr != OF_BAD_ADDR)
|
||||||
gpio_reg = ioremap(gaddr, 0x10);
|
gpio_reg = ioremap(gaddr, 0x10);
|
||||||
}
|
}
|
||||||
if (gpio_reg == NULL)
|
if (gpio_reg == NULL) {
|
||||||
printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n");
|
printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n");
|
||||||
|
goto fail_gpio;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
pmu_kind = PMU_UNKNOWN;
|
pmu_kind = PMU_UNKNOWN;
|
||||||
|
|
||||||
|
@ -365,6 +367,9 @@ int __init find_via_pmu(void)
|
||||||
return 1;
|
return 1;
|
||||||
fail:
|
fail:
|
||||||
of_node_put(vias);
|
of_node_put(vias);
|
||||||
|
iounmap(gpio_reg);
|
||||||
|
gpio_reg = NULL;
|
||||||
|
fail_gpio:
|
||||||
vias = NULL;
|
vias = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue