Skip to contentSkip to conversation

fpga: stratix10-soc: Do not use ret uninitialized in s10_probe()

PATCH Superseded Nathan Chancellor 3 participants 3 messages Nov 29, 2021 FPGA manager framework

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fpga: stratix10-soc: Do not use ret uninitialized in s10_probe()

Clang warns:

drivers/fpga/stratix10-soc.c:431:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]

        return ret;
               ^~~
drivers/fpga/stratix10-soc.c:402:9: note: initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0

1 warning generated.

ret is only assigned in an error path now so just return 0 directly.

Fixes 4ba0b2c294fe ("fpga: mgr: Use standard dev_release for class driver")
---
 drivers/fpga/stratix10-soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/stratix10-soc.c +1 -1
index 737d14c6e0de..357cea58ec98 100644
@@ -428,7 +428,7 @@ static int s10_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, mgr);
-	return ret;
+	return 0;
 
 probe_err:
 	stratix10_svc_free_channel(priv->chan);

base-commit: 8886a579744fbfa53e69aa453ed10ae3b1f9abac

Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nathan Chancellor

Clang warns:

drivers/fpga/stratix10-soc.c:431:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]

         return ret;
                ^~~
drivers/fpga/stratix10-soc.c:402:9: note: initialize the variable 'ret' to silence this warning
         int ret;
                ^
                 = 0

This line to contradicts what you did, to reduce confusion, remove the 'silence this warning line'

Change itself looks fine.

Quoted 26 lines

1 warning generated.

ret is only assigned in an error path now so just return 0 directly.

Fixes 4ba0b2c294fe ("fpga: mgr: Use standard dev_release for class driver")
---
  drivers/fpga/stratix10-soc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/stratix10-soc.c +1 -1
index 737d14c6e0de..357cea58ec98 100644
@@ -428,7 +428,7 @@ static int s10_probe(struct platform_device *pdev)
  	}
 
  	platform_set_drvdata(pdev, mgr);
-	return ret;
+	return 0;
 
  probe_err:
  	stratix10_svc_free_channel(priv->chan);

base-commit: 8886a579744fbfa53e69aa453ed10ae3b1f9abac

Reviewed-by on v1 1/1
#2 lore raw
In reply to Nathan Chancellor

Thanks,
- Russ

Quoted 35 lines · Nathan Chancellor

Clang warns:

drivers/fpga/stratix10-soc.c:431:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]

        return ret;
               ^~~
drivers/fpga/stratix10-soc.c:402:9: note: initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0

1 warning generated.

ret is only assigned in an error path now so just return 0 directly.

Fixes 4ba0b2c294fe ("fpga: mgr: Use standard dev_release for class driver")
---
 drivers/fpga/stratix10-soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/stratix10-soc.c +1 -1
index 737d14c6e0de..357cea58ec98 100644
@@ -428,7 +428,7 @@ static int s10_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, mgr);
-	return ret;
+	return 0;
 
 probe_err:
 	stratix10_svc_free_channel(priv->chan);

base-commit: 8886a579744fbfa53e69aa453ed10ae3b1f9abac