linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ARM: qcom: silence an uninitialized variable warning
@ 2016-04-13  6:45 Dan Carpenter
  2016-04-14  0:35 ` Tim Bird
  2016-04-14  1:53 ` Arnd Bergmann
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-04-13  6:45 UTC (permalink / raw)
  To: Arnd Bergmann, Tim Bird; +Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors

It's harmless but, if "enable" isn't set, then we pass uninitialized
values to qcom_coincell_chgr_config().  The values aren't used, but
let's silence the warning anyway.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/misc/qcom-coincell.c b/drivers/misc/qcom-coincell.c
index 7b4a2da..829a61d 100644
--- a/drivers/misc/qcom-coincell.c
+++ b/drivers/misc/qcom-coincell.c
@@ -94,7 +94,8 @@ static int qcom_coincell_probe(struct platform_device *pdev)
 {
 	struct device_node *node = pdev->dev.of_node;
 	struct qcom_coincell chgr;
-	u32 rset, vset;
+	u32 rset = 0;
+	u32 vset = 0;
 	bool enable;
 	int rc;
 

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

* Re: [patch] ARM: qcom: silence an uninitialized variable warning
  2016-04-13  6:45 [patch] ARM: qcom: silence an uninitialized variable warning Dan Carpenter
@ 2016-04-14  0:35 ` Tim Bird
  2016-04-14  1:53 ` Arnd Bergmann
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Bird @ 2016-04-14  0:35 UTC (permalink / raw)
  To: Dan Carpenter, Arnd Bergmann
  Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors



On 04/12/2016 11:45 PM, Dan Carpenter wrote:
> It's harmless but, if "enable" isn't set, then we pass uninitialized
> values to qcom_coincell_chgr_config().  The values aren't used, but
> let's silence the warning anyway.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/misc/qcom-coincell.c b/drivers/misc/qcom-coincell.c
> index 7b4a2da..829a61d 100644
> --- a/drivers/misc/qcom-coincell.c
> +++ b/drivers/misc/qcom-coincell.c
> @@ -94,7 +94,8 @@ static int qcom_coincell_probe(struct platform_device *pdev)
>  {
>  	struct device_node *node = pdev->dev.of_node;
>  	struct qcom_coincell chgr;
> -	u32 rset, vset;
> +	u32 rset = 0;
> +	u32 vset = 0;
>  	bool enable;
>  	int rc;
>  
> 
Looks OK to me.  Thanks for the warning cleanup!

Acked-by: Tim Bird
 -- Tim

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

* Re: [patch] ARM: qcom: silence an uninitialized variable warning
  2016-04-13  6:45 [patch] ARM: qcom: silence an uninitialized variable warning Dan Carpenter
  2016-04-14  0:35 ` Tim Bird
@ 2016-04-14  1:53 ` Arnd Bergmann
  2016-04-14  9:03   ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2016-04-14  1:53 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Tim Bird, Greg Kroah-Hartman, linux-kernel, kernel-janitors

On Wednesday 13 April 2016, Dan Carpenter wrote:
> It's harmless but, if "enable" isn't set, then we pass uninitialized
> values to qcom_coincell_chgr_config().  The values aren't used, but
> let's silence the warning anyway.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

I haven't seen this warning in my tests, which means it probably doesn't show up
in the usual configurations. Are you sure this doesn't just happen with
CONFIG_PROFILE_ALL_BRANCHES, CONFIG_CC_OPTIMIZE_FOR_SIZE or CONFIG_GCOV_PROFILE_ALL,
or with versions of gcc before 4.9?

	Arnd

> diff --git a/drivers/misc/qcom-coincell.c b/drivers/misc/qcom-coincell.c
> index 7b4a2da..829a61d 100644
> --- a/drivers/misc/qcom-coincell.c
> +++ b/drivers/misc/qcom-coincell.c
> @@ -94,7 +94,8 @@ static int qcom_coincell_probe(struct platform_device *pdev)
>  {
>  	struct device_node *node = pdev->dev.of_node;
>  	struct qcom_coincell chgr;
> -	u32 rset, vset;
> +	u32 rset = 0;
> +	u32 vset = 0;
>  	bool enable;
>  	int rc;
>  
> 

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

* Re: [patch] ARM: qcom: silence an uninitialized variable warning
  2016-04-14  1:53 ` Arnd Bergmann
@ 2016-04-14  9:03   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-04-14  9:03 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Tim Bird, Greg Kroah-Hartman, linux-kernel, kernel-janitors

On Thu, Apr 14, 2016 at 03:53:03AM +0200, Arnd Bergmann wrote:
> On Wednesday 13 April 2016, Dan Carpenter wrote:
> > It's harmless but, if "enable" isn't set, then we pass uninitialized
> > values to qcom_coincell_chgr_config().  The values aren't used, but
> > let's silence the warning anyway.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> I haven't seen this warning in my tests, which means it probably doesn't show up
> in the usual configurations. Are you sure this doesn't just happen with
> CONFIG_PROFILE_ALL_BRANCHES, CONFIG_CC_OPTIMIZE_FOR_SIZE or CONFIG_GCOV_PROFILE_ALL,
> or with versions of gcc before 4.9?
> 

This is a smatch stuff I'm working on.  Realistically, I have to make
Smatch warn when we pass uninitialized values to a function.  I can't
make smatch do the extra analysis to test if the values are used or not.

regards,
dan carpenter

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

end of thread, other threads:[~2016-04-14  9:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13  6:45 [patch] ARM: qcom: silence an uninitialized variable warning Dan Carpenter
2016-04-14  0:35 ` Tim Bird
2016-04-14  1:53 ` Arnd Bergmann
2016-04-14  9:03   ` Dan Carpenter

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).