]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: stmmac: fix leaks in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 12 Jul 2022 14:42:25 +0000 (17:42 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Jul 2022 13:21:42 +0000 (14:21 +0100)
These two error paths should clean up before returning.

Fixes: 3c7d91cd5f9a ("net: stmmac: Add Ingenic SoCs MAC support.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c

index 9a6d819b84aeadd19a0bbeebec9ac458dc770914..378b4dd826bb5e393382569a262047d309dd2b96 100644 (file)
@@ -273,7 +273,8 @@ static int ingenic_mac_probe(struct platform_device *pdev)
                        mac->tx_delay = tx_delay_ps * 1000;
                } else {
                        dev_err(&pdev->dev, "Invalid TX clock delay: %dps\n", tx_delay_ps);
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto err_remove_config_dt;
                }
        }
 
@@ -283,7 +284,8 @@ static int ingenic_mac_probe(struct platform_device *pdev)
                        mac->rx_delay = rx_delay_ps * 1000;
                } else {
                        dev_err(&pdev->dev, "Invalid RX clock delay: %dps\n", rx_delay_ps);
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto err_remove_config_dt;
                }
        }