提交 08d18f3b 编写于 作者: A Anton Vorontsov 提交者: David S. Miller

fsl_pq_mdio: Fix mdiobus allocation handling

The driver could return success code even if mdiobus_alloc() failed.
This patch fixes the issue.
Signed-off-by: NAnton Vorontsov <avorontsov@mvista.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a2f79227
...@@ -277,15 +277,17 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, ...@@ -277,15 +277,17 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
int tbiaddr = -1; int tbiaddr = -1;
const u32 *addrp; const u32 *addrp;
u64 addr = 0, size = 0; u64 addr = 0, size = 0;
int err = 0; int err;
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
new_bus = mdiobus_alloc(); new_bus = mdiobus_alloc();
if (NULL == new_bus) if (!new_bus) {
err = -ENOMEM;
goto err_free_priv; goto err_free_priv;
}
new_bus->name = "Freescale PowerQUICC MII Bus", new_bus->name = "Freescale PowerQUICC MII Bus",
new_bus->read = &fsl_pq_mdio_read, new_bus->read = &fsl_pq_mdio_read,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册