Merge remote-tracking branches 'asoc/topic/ab8500', 'asoc/topic/arizona', 'asoc/topic...
[sfrench/cifs-2.6.git] / drivers / net / ethernet / stmicro / stmmac / dwmac-meson.c
index 309d99536a2c617264167d878a5239b9cdb85865..7fdd1760a74c951a63282db15ab4f9ece2bc8abf 100644 (file)
@@ -64,18 +64,31 @@ static int meson6_dwmac_probe(struct platform_device *pdev)
                return PTR_ERR(plat_dat);
 
        dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
-       if (!dwmac)
-               return -ENOMEM;
+       if (!dwmac) {
+               ret = -ENOMEM;
+               goto err_remove_config_dt;
+       }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
        dwmac->reg = devm_ioremap_resource(&pdev->dev, res);
-       if (IS_ERR(dwmac->reg))
-               return PTR_ERR(dwmac->reg);
+       if (IS_ERR(dwmac->reg)) {
+               ret = PTR_ERR(dwmac->reg);
+               goto err_remove_config_dt;
+       }
 
        plat_dat->bsp_priv = dwmac;
        plat_dat->fix_mac_speed = meson6_dwmac_fix_mac_speed;
 
-       return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+       ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+       if (ret)
+               goto err_remove_config_dt;
+
+       return 0;
+
+err_remove_config_dt:
+       stmmac_remove_config_dt(pdev, plat_dat);
+
+       return ret;
 }
 
 static const struct of_device_id meson6_dwmac_match[] = {