Commit c9445e0b authored by Jisheng Zhang's avatar Jisheng Zhang Committed by David S. Miller

net: stmmac: dwmac-sti: use devm_stmmac_probe_config_dt()

Simplify the driver's probe() function by using the devres
variant of stmmac_probe_config_dt().
Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6d6c1193
...@@ -273,20 +273,18 @@ static int sti_dwmac_probe(struct platform_device *pdev) ...@@ -273,20 +273,18 @@ static int sti_dwmac_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
if (IS_ERR(plat_dat)) if (IS_ERR(plat_dat))
return PTR_ERR(plat_dat); return PTR_ERR(plat_dat);
dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
if (!dwmac) { if (!dwmac)
ret = -ENOMEM; return -ENOMEM;
goto err_remove_config_dt;
}
ret = sti_dwmac_parse_data(dwmac, pdev); ret = sti_dwmac_parse_data(dwmac, pdev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Unable to parse OF data\n"); dev_err(&pdev->dev, "Unable to parse OF data\n");
goto err_remove_config_dt; return ret;
} }
dwmac->fix_retime_src = data->fix_retime_src; dwmac->fix_retime_src = data->fix_retime_src;
...@@ -296,7 +294,7 @@ static int sti_dwmac_probe(struct platform_device *pdev) ...@@ -296,7 +294,7 @@ static int sti_dwmac_probe(struct platform_device *pdev)
ret = clk_prepare_enable(dwmac->clk); ret = clk_prepare_enable(dwmac->clk);
if (ret) if (ret)
goto err_remove_config_dt; return ret;
ret = sti_dwmac_set_mode(dwmac); ret = sti_dwmac_set_mode(dwmac);
if (ret) if (ret)
...@@ -310,8 +308,6 @@ static int sti_dwmac_probe(struct platform_device *pdev) ...@@ -310,8 +308,6 @@ static int sti_dwmac_probe(struct platform_device *pdev)
disable_clk: disable_clk:
clk_disable_unprepare(dwmac->clk); clk_disable_unprepare(dwmac->clk);
err_remove_config_dt:
stmmac_remove_config_dt(pdev, plat_dat);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment