Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3420ea88 authored by Johan Hovold's avatar Johan Hovold Committed by David S. Miller
Browse files

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: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7fe9d46
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);