diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2008-03-21 23:20:29 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-03-24 02:55:48 -0400 |
commit | b8c19eb16a7e6df57d0f6d67e42ce026e5d5930b (patch) | |
tree | 5a8fd8fef3283cafbbe1419ca296eaa293d07afa /drivers | |
parent | 1428a9fa586cb80acf98289f797f58b8bd662598 (diff) |
[POWERPC] mpc5200-fec: Fix possible NULL dereference in mdio driver
If the reg property is missing from the phy node (unlikely, but possible),
then the kernel will oops with a NULL pointer dereference. This fixes
it by checking the pointer first.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fec_mpc52xx_phy.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index 1837584c4504..6a3ac4ea97e9 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c | |||
@@ -109,7 +109,8 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_i | |||
109 | int irq = irq_of_parse_and_map(child, 0); | 109 | int irq = irq_of_parse_and_map(child, 0); |
110 | if (irq != NO_IRQ) { | 110 | if (irq != NO_IRQ) { |
111 | const u32 *id = of_get_property(child, "reg", NULL); | 111 | const u32 *id = of_get_property(child, "reg", NULL); |
112 | bus->irq[*id] = irq; | 112 | if (id) |
113 | bus->irq[*id] = irq; | ||
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||