net: stmmac: dwmac-sti: use devm_stmmac_probe_config_dt()
authorJisheng Zhang <jszhang@kernel.org>
Sat, 16 Sep 2023 07:58:22 +0000 (15:58 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Sep 2023 11:44:35 +0000 (12:44 +0100)
Simplify the driver's probe() function by using the devres
variant of stmmac_probe_config_dt().

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c

index 0d653bbb931bdd0d110935575fdc536f9ea5bbff..4445cddc4cbed9a48d823d7d58742d5ea96b9bab 100644 (file)
@@ -273,20 +273,18 @@ static int sti_dwmac_probe(struct platform_device *pdev)
        if (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))
                return PTR_ERR(plat_dat);
 
        dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
-       if (!dwmac) {
-               ret = -ENOMEM;
-               goto err_remove_config_dt;
-       }
+       if (!dwmac)
+               return -ENOMEM;
 
        ret = sti_dwmac_parse_data(dwmac, pdev);
        if (ret) {
                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;
@@ -296,7 +294,7 @@ static int sti_dwmac_probe(struct platform_device *pdev)
 
        ret = clk_prepare_enable(dwmac->clk);
        if (ret)
-               goto err_remove_config_dt;
+               return ret;
 
        ret = sti_dwmac_set_mode(dwmac);
        if (ret)
@@ -310,8 +308,6 @@ static int sti_dwmac_probe(struct platform_device *pdev)
 
 disable_clk:
        clk_disable_unprepare(dwmac->clk);
-err_remove_config_dt:
-       stmmac_remove_config_dt(pdev, plat_dat);
 
        return ret;
 }