提交 58459a4e 编写于 作者: R Roel Kluin 提交者: Kumar Gala

powerpc/82xx: kmalloc failure ignored in ep8248e_mdio_probe()

Prevent NULL dereference if kmalloc() fails. Also clean up if
of_mdiobus_register() returns an error.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Acked-by: NScott Wood <scottwood@freescale.com>
Signed-off-by: NKumar Gala <galak@kernel.crashing.org>
上级 cb5485a0
......@@ -132,12 +132,25 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev,
return -ENOMEM;
bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
if (bus->irq == NULL) {
ret = -ENOMEM;
goto err_free_bus;
}
bus->name = "ep8248e-mdio-bitbang";
bus->parent = &ofdev->dev;
snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
return of_mdiobus_register(bus, ofdev->node);
ret = of_mdiobus_register(bus, ofdev->node);
if (ret)
goto err_free_irq;
return 0;
err_free_irq:
kfree(bus->irq);
err_free_bus:
free_mdio_bitbang(bus);
return ret;
}
static int ep8248e_mdio_remove(struct of_device *ofdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册