diff mbox series

[-next] net: stmmac: Fix an error code in dwmac-ingenic.c

Message ID 1623811148-11064-1-git-send-email-yang.lee@linux.alibaba.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [-next] net: stmmac: Fix an error code in dwmac-ingenic.c | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yang Li June 16, 2021, 2:39 a.m. UTC
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 <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrew Lunn June 24, 2021, 2:25 p.m. UTC | #1
On Wed, Jun 16, 2021 at 10:39:08AM +0800, Yang Li wrote:
> 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 <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
> index 60984c1..f3950e0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
> @@ -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
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
index 60984c1..f3950e0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
@@ -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;
 	}