diff mbox series

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

Message ID 20211130221123.3800420-1-nathan@kernel.org (mailing list archive)
State New
Headers show
Series [v2] fpga: stratix10-soc: Do not use ret uninitialized in s10_probe() | expand

Commit Message

Nathan Chancellor Nov. 30, 2021, 10:11 p.m. UTC
Clang warns:

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

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")
Link: https://github.com/ClangBuiltLinux/linux/issues/1517
Reviewed-by: Russ Weight <russell.h.weight@intel.com>
Reviewed-by: Tom Rix <trix@redhat.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---

v1 -> v2: https://lore.kernel.org/r/20211129161009.3625548-1-nathan@kernel.org/

* Drop clang's suggestion text (Tom).

* Pick up Russ and Tom's review tags.

 drivers/fpga/stratix10-soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 8886a579744fbfa53e69aa453ed10ae3b1f9abac

Comments

Xu Yilun Dec. 1, 2021, 12:48 a.m. UTC | #1
On Tue, Nov 30, 2021 at 03:11:24PM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/fpga/stratix10-soc.c:431:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
>         return ret;
>                ^~~
> 
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1517
> Reviewed-by: Russ Weight <russell.h.weight@intel.com>
> Reviewed-by: Tom Rix <trix@redhat.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Acked-by: Xu Yilun <yilun.xu@intel.com>

Thanks,
Yilun

> ---
> 
> v1 -> v2: https://lore.kernel.org/r/20211129161009.3625548-1-nathan@kernel.org/
> 
> * Drop clang's suggestion text (Tom).
> 
> * Pick up Russ and Tom's review tags.
> 
>  drivers/fpga/stratix10-soc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
> index 737d14c6e0de..357cea58ec98 100644
> --- a/drivers/fpga/stratix10-soc.c
> +++ b/drivers/fpga/stratix10-soc.c
> @@ -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
> -- 
> 2.34.1
Moritz Fischer Dec. 3, 2021, 4:10 a.m. UTC | #2
On Tue, Nov 30, 2021 at 03:11:24PM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/fpga/stratix10-soc.c:431:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
>         return ret;
>                ^~~
> 
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1517
> Reviewed-by: Russ Weight <russell.h.weight@intel.com>
> Reviewed-by: Tom Rix <trix@redhat.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> 
> v1 -> v2: https://lore.kernel.org/r/20211129161009.3625548-1-nathan@kernel.org/
> 
> * Drop clang's suggestion text (Tom).
> 
> * Pick up Russ and Tom's review tags.
> 
>  drivers/fpga/stratix10-soc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
> index 737d14c6e0de..357cea58ec98 100644
> --- a/drivers/fpga/stratix10-soc.c
> +++ b/drivers/fpga/stratix10-soc.c
> @@ -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
> -- 
> 2.34.1
> 
Applied to for-next,

Thanks
diff mbox series

Patch

diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
index 737d14c6e0de..357cea58ec98 100644
--- a/drivers/fpga/stratix10-soc.c
+++ b/drivers/fpga/stratix10-soc.c
@@ -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);