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'
Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 1 +
1 file changed, 1 insertion(+)
@@ -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;gotoerr_remove_config_dt;}
From: Andrew Lunn <andrew@lunn.ch> Date: 2021-06-24 14:26:05
On Wed, Jun 16, 2021 at 10:39:08AM +0800, Yang Li wrote:
quoted hunk
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'
Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 1 +
1 file changed, 1 insertion(+)
@@ -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