linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: stratix10-soc: Do not use ret uninitialized in s10_probe()
@ 2021-11-29 16:10 Nathan Chancellor
  2021-11-29 16:35 ` Tom Rix
  2021-11-29 19:24 ` Russ Weight
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2021-11-29 16:10 UTC (permalink / raw)
  To: Moritz Fischer, Wu Hao, Xu Yilun
  Cc: Tom Rix, Nick Desaulniers, Russ Weight, Dan Carpenter,
	linux-fpga, linux-kernel, llvm, 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")
Link: https://github.com/ClangBuiltLinux/linux/issues/1517
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fpga: stratix10-soc: Do not use ret uninitialized in s10_probe()
  2021-11-29 16:10 [PATCH] fpga: stratix10-soc: Do not use ret uninitialized in s10_probe() Nathan Chancellor
@ 2021-11-29 16:35 ` Tom Rix
  2021-11-29 19:24 ` Russ Weight
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rix @ 2021-11-29 16:35 UTC (permalink / raw)
  To: Nathan Chancellor, Moritz Fischer, Wu Hao, Xu Yilun
  Cc: Nick Desaulniers, Russ Weight, Dan Carpenter, linux-fpga,
	linux-kernel, llvm


On 11/29/21 8:10 AM, Nathan Chancellor wrote:
> 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.

Reviewed-by: Tom Rix <trix@redhat.com>

> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1517
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>   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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fpga: stratix10-soc: Do not use ret uninitialized in s10_probe()
  2021-11-29 16:10 [PATCH] fpga: stratix10-soc: Do not use ret uninitialized in s10_probe() Nathan Chancellor
  2021-11-29 16:35 ` Tom Rix
@ 2021-11-29 19:24 ` Russ Weight
  1 sibling, 0 replies; 3+ messages in thread
From: Russ Weight @ 2021-11-29 19:24 UTC (permalink / raw)
  To: Nathan Chancellor, Moritz Fischer, Wu Hao, Xu Yilun
  Cc: Tom Rix, Nick Desaulniers, Dan Carpenter, linux-fpga, linux-kernel, llvm

Reviewed-by: Russ Weight <russell.h.weight@intel.com>

Thanks,
- Russ

On 11/29/21 8:10 AM, Nathan Chancellor wrote:
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1517
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-29 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 16:10 [PATCH] fpga: stratix10-soc: Do not use ret uninitialized in s10_probe() Nathan Chancellor
2021-11-29 16:35 ` Tom Rix
2021-11-29 19:24 ` Russ Weight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).