]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: stmmac: dwmac-meson8b: Fix an error handling path in 'meson8b_dwmac_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 11 Jun 2018 17:52:27 +0000 (19:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Jun 2018 22:36:14 +0000 (15:36 -0700)
If 'of_device_get_match_data()' fails, we need to release some resources as
done in the other error handling path of this function.

Fixes: efacb568c962 ("net: stmmac: dwmac-meson: extend phy mode setting")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c

index 4ff231df73225dc449b21c7c1f312666b2a957fd..c5979569fd60f28fbf67b72f0c03cd613355d9cc 100644 (file)
@@ -334,9 +334,10 @@ static int meson8b_dwmac_probe(struct platform_device *pdev)
 
        dwmac->data = (const struct meson8b_dwmac_data *)
                of_device_get_match_data(&pdev->dev);
-       if (!dwmac->data)
-               return -EINVAL;
-
+       if (!dwmac->data) {
+               ret = -EINVAL;
+               goto err_remove_config_dt;
+       }
        res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
        dwmac->regs = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(dwmac->regs)) {