|
@@ -271,15 +271,17 @@ static int ipq806x_gmac_probe(struct platform_device *pdev)
|
|
|
return PTR_ERR(plat_dat);
|
|
return PTR_ERR(plat_dat);
|
|
|
|
|
|
|
|
gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);
|
|
gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);
|
|
|
- if (!gmac)
|
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
|
+ if (!gmac) {
|
|
|
|
|
+ err = -ENOMEM;
|
|
|
|
|
+ goto err_remove_config_dt;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
gmac->pdev = pdev;
|
|
gmac->pdev = pdev;
|
|
|
|
|
|
|
|
err = ipq806x_gmac_of_parse(gmac);
|
|
err = ipq806x_gmac_of_parse(gmac);
|
|
|
if (err) {
|
|
if (err) {
|
|
|
dev_err(dev, "device tree parsing error\n");
|
|
dev_err(dev, "device tree parsing error\n");
|
|
|
- return err;
|
|
|
|
|
|
|
+ goto err_remove_config_dt;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
regmap_write(gmac->qsgmii_csr, QSGMII_PCS_CAL_LCKDT_CTL,
|
|
regmap_write(gmac->qsgmii_csr, QSGMII_PCS_CAL_LCKDT_CTL,
|
|
@@ -300,7 +302,8 @@ static int ipq806x_gmac_probe(struct platform_device *pdev)
|
|
|
default:
|
|
default:
|
|
|
dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
|
|
dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
|
|
|
phy_modes(gmac->phy_mode));
|
|
phy_modes(gmac->phy_mode));
|
|
|
- return -EINVAL;
|
|
|
|
|
|
|
+ err = -EINVAL;
|
|
|
|
|
+ goto err_remove_config_dt;
|
|
|
}
|
|
}
|
|
|
regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val);
|
|
regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val);
|
|
|
|
|
|
|
@@ -319,7 +322,8 @@ static int ipq806x_gmac_probe(struct platform_device *pdev)
|
|
|
default:
|
|
default:
|
|
|
dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
|
|
dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n",
|
|
|
phy_modes(gmac->phy_mode));
|
|
phy_modes(gmac->phy_mode));
|
|
|
- return -EINVAL;
|
|
|
|
|
|
|
+ err = -EINVAL;
|
|
|
|
|
+ goto err_remove_config_dt;
|
|
|
}
|
|
}
|
|
|
regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val);
|
|
regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val);
|
|
|
|
|
|
|
@@ -346,7 +350,16 @@ static int ipq806x_gmac_probe(struct platform_device *pdev)
|
|
|
plat_dat->bsp_priv = gmac;
|
|
plat_dat->bsp_priv = gmac;
|
|
|
plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;
|
|
plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;
|
|
|
|
|
|
|
|
- return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
|
|
|
|
|
|
+ err = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
|
|
|
|
+ if (err)
|
|
|
|
|
+ goto err_remove_config_dt;
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
|
|
+
|
|
|
|
|
+err_remove_config_dt:
|
|
|
|
|
+ stmmac_remove_config_dt(pdev, plat_dat);
|
|
|
|
|
+
|
|
|
|
|
+ return err;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static const struct of_device_id ipq806x_gmac_dwmac_match[] = {
|
|
static const struct of_device_id ipq806x_gmac_dwmac_match[] = {
|