net: stmmac: Fix an error code in dwmac-ingenic.c
Subsystems (4)
PATCH 1/1 net: stmmac: Fix an error code in dwmac-ingenic.c
When IS_ERR(mac->regmap) returns true, the value of ret is 0. So, we set ret to -ENODEV to indicate this error.
Clean up smatch warning:drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c:266 ingenic_mac_probe() warn: missing error code 'ret'
--- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +1 -0
@@ -263,6 +263,7 @@ static int ingenic_mac_probe(struct platform_device *pdev) mac->regmap =syscon_regmap_lookup_by_phandle (pdev->dev.of_node,"mode-reg" );if (IS_ERR (mac->regmap)) {dev_err (&pdev->dev,"%s: Failed to get syscon regmap\n" , __func__); + ret = -ENODEV ; goto err_remove_config_dt; }
Signature · 1 line
1.8.3.1
Quoted 18 lines · Yang Li
When
IS_ERR(mac->regmap)returns true, the value of ret is 0. So, we set ret to-ENODEVto indicate this error.Clean up smatch warning:
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c:266ingenic_mac_probe()warn: missing error code 'ret'Reported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +0
-0
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c static int ingenic_mac_probe(struct platform_device *pdev) · line 266
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +1
-0@@ -263,6 +263,7 @@ static int ingenic_mac_probe(struct platform_device *pdev) mac->regmap =syscon_regmap_lookup_by_phandle (pdev->dev.of_node,"mode-reg" );if (IS_ERR (mac->regmap)) {dev_err (&pdev->dev,"%s: Failed to get syscon regmap\n" , __func__); + ret = -ENODEV ;
mac->regmap is a ERR_PTR(), containing an error code. Please use that error code, not ENODEV.
Andrew