X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH] eeepc-laptop: fix a Wuninitialized warning
@ 2014-09-12  8:44 Chen Hanxiao
  2014-09-12 20:53 ` Darren Hart
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Hanxiao @ 2014-09-12  8:44 UTC (permalink / raw)
  To: acpi4asus-user, platform-driver-x86; +Cc: Corentin Chary, Chen Hanxiao

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
---
 drivers/platform/x86/eeepc-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index bd533c2..738fc0c 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -276,7 +276,7 @@ static ssize_t store_sys_acpi(struct device *dev, int cm,
 			      const char *buf, size_t count)
 {
 	struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
-	int rv, value;
+	int rv, value = -1;
 
 	rv = parse_arg(buf, count, &value);
 	if (rv > 0)
-- 
1.9.0

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

* Re: [PATCH] eeepc-laptop: fix a Wuninitialized warning
  2014-09-12  8:44 [PATCH] eeepc-laptop: fix a Wuninitialized warning Chen Hanxiao
@ 2014-09-12 20:53 ` Darren Hart
  2014-09-15  2:16   ` Chen, Hanxiao
  0 siblings, 1 reply; 4+ messages in thread
From: Darren Hart @ 2014-09-12 20:53 UTC (permalink / raw)
  To: Chen Hanxiao; +Cc: acpi4asus-user, platform-driver-x86, Corentin Chary

On Fri, Sep 12, 2014 at 04:44:26PM +0800, Chen Hanxiao wrote:

Hi Chen,

I don't see such a warning with gcc 4.9.1. Which compiler are you using?

Please include these sorts of details (which compiler, etc.) when submitting
patches. I will never merge a patch without a complete commit message.


> Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
> ---
>  drivers/platform/x86/eeepc-laptop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
> index bd533c2..738fc0c 100644
> --- a/drivers/platform/x86/eeepc-laptop.c
> +++ b/drivers/platform/x86/eeepc-laptop.c
> @@ -276,7 +276,7 @@ static ssize_t store_sys_acpi(struct device *dev, int cm,
>  			      const char *buf, size_t count)
>  {
>  	struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
> -	int rv, value;
> +	int rv, value = -1;
>  
>  	rv = parse_arg(buf, count, &value);

Inspecting the code, I don't see how this could possibly result in the use of an
uninitialized variable.

-- 
Darren Hart
Intel Open Source Technology Center

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

* RE: [PATCH] eeepc-laptop: fix a Wuninitialized warning
  2014-09-12 20:53 ` Darren Hart
@ 2014-09-15  2:16   ` Chen, Hanxiao
  2014-09-15 17:40     ` Darren Hart
  0 siblings, 1 reply; 4+ messages in thread
From: Chen, Hanxiao @ 2014-09-15  2:16 UTC (permalink / raw)
  To: Darren Hart
  Cc: acpi4asus-user@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org, Corentin Chary



> -----Original Message-----
> From: Darren Hart [mailto:dvhart@infradead.org]
> On Fri, Sep 12, 2014 at 04:44:26PM +0800, Chen Hanxiao wrote:
> 
> Hi Chen,
> 
> I don't see such a warning with gcc 4.9.1. Which compiler are you using?
> 

I'm using gcc 4.8.2 on Fedora20.
Should we ignore the warning of old version of gcc?

If not, I'll resend this with a detail commit message.

Thanks for your help.

- Chen

> Please include these sorts of details (which compiler, etc.) when submitting
> patches. I will never merge a patch without a complete commit message.
> 
> 
> > Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
> > ---
> >  drivers/platform/x86/eeepc-laptop.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/x86/eeepc-laptop.c
> b/drivers/platform/x86/eeepc-laptop.c
> > index bd533c2..738fc0c 100644
> > --- a/drivers/platform/x86/eeepc-laptop.c
> > +++ b/drivers/platform/x86/eeepc-laptop.c
> > @@ -276,7 +276,7 @@ static ssize_t store_sys_acpi(struct device *dev, int cm,
> >  			      const char *buf, size_t count)
> >  {
> >  	struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
> > -	int rv, value;
> > +	int rv, value = -1;
> >
> >  	rv = parse_arg(buf, count, &value);
> 
> Inspecting the code, I don't see how this could possibly result in the use of
> an
> uninitialized variable.
> 
> --
> Darren Hart
> Intel Open Source Technology Center

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

* Re: [PATCH] eeepc-laptop: fix a Wuninitialized warning
  2014-09-15  2:16   ` Chen, Hanxiao
@ 2014-09-15 17:40     ` Darren Hart
  0 siblings, 0 replies; 4+ messages in thread
From: Darren Hart @ 2014-09-15 17:40 UTC (permalink / raw)
  To: Chen, Hanxiao, Rafael J. Wysocki
  Cc: acpi4asus-user@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org, Corentin Chary

On Mon, Sep 15, 2014 at 02:16:35AM +0000, Chen, Hanxiao wrote:
> 
> 
> > -----Original Message-----
> > From: Darren Hart [mailto:dvhart@infradead.org]
> > On Fri, Sep 12, 2014 at 04:44:26PM +0800, Chen Hanxiao wrote:
> > 
> > Hi Chen,
> > 
> > I don't see such a warning with gcc 4.9.1. Which compiler are you using?
> > 
> 
> I'm using gcc 4.8.2 on Fedora20.
> Should we ignore the warning of old version of gcc?
> 
> If not, I'll resend this with a detail commit message.

In my experience, we do not add workarounds for buggy compilers reporting bogus
unitialized variable warnings because those workarounds effectively mask
legitimate uninitialized variable cases.

Rafael, do you agree?

Thanks,

Darren


> 
> Thanks for your help.
> 
> - Chen
> 
> > Please include these sorts of details (which compiler, etc.) when submitting
> > patches. I will never merge a patch without a complete commit message.
> > 
> > 
> > > Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
> > > ---
> > >  drivers/platform/x86/eeepc-laptop.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/platform/x86/eeepc-laptop.c
> > b/drivers/platform/x86/eeepc-laptop.c
> > > index bd533c2..738fc0c 100644
> > > --- a/drivers/platform/x86/eeepc-laptop.c
> > > +++ b/drivers/platform/x86/eeepc-laptop.c
> > > @@ -276,7 +276,7 @@ static ssize_t store_sys_acpi(struct device *dev, int cm,
> > >  			      const char *buf, size_t count)
> > >  {
> > >  	struct eeepc_laptop *eeepc = dev_get_drvdata(dev);
> > > -	int rv, value;
> > > +	int rv, value = -1;
> > >
> > >  	rv = parse_arg(buf, count, &value);
> > 
> > Inspecting the code, I don't see how this could possibly result in the use of
> > an
> > uninitialized variable.
> > 
> > --
> > Darren Hart
> > Intel Open Source Technology Center

-- 
Darren Hart
Intel Open Source Technology Center

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

end of thread, other threads:[~2014-09-15 17:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-12  8:44 [PATCH] eeepc-laptop: fix a Wuninitialized warning Chen Hanxiao
2014-09-12 20:53 ` Darren Hart
2014-09-15  2:16   ` Chen, Hanxiao
2014-09-15 17:40     ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox