提交 3420ea88 编写于 作者: J Johan Hovold 提交者: David S. Miller

net: ethernet: ti: cpsw: add missing sanity check

Make sure to check for allocation failures before dereferencing a
NULL-pointer during probe.

Fixes: 649a1688 ("net: ethernet: ti: cpsw: create common struct to
hold shared driver data")
Signed-off-by: NJohan Hovold <johan@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a7fe9d46
......@@ -2588,6 +2588,9 @@ static int cpsw_probe(struct platform_device *pdev)
int irq;
cpsw = devm_kzalloc(&pdev->dev, sizeof(struct cpsw_common), GFP_KERNEL);
if (!cpsw)
return -ENOMEM;
cpsw->dev = &pdev->dev;
ndev = alloc_etherdev_mq(sizeof(struct cpsw_priv), CPSW_MAX_QUEUES);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册