public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schlemmer <azarah@gentoo.org>
To: Greg KH <greg@kroah.com>
Cc: KML <linux-kernel@vger.kernel.org>, sensors@Stimpy.netroedge.com
Subject: Re: [PATCH-2.5] Fix w83781d sensor to use Milli-Volt for in_* in sysfs
Date: 09 Apr 2003 08:18:21 +0200	[thread overview]
Message-ID: <1049869101.2754.31.camel@workshop.saharact.lan> (raw)
In-Reply-To: <20030408220444.GA6674@kroah.com>

On Wed, 2003-04-09 at 00:04, Greg KH wrote:

> Oh, I'm getting the following warning when building the driver, want to
> look into this?
> 
> drivers/i2c/chips/w83781d.c: In function `store_fan_div_reg':
> drivers/i2c/chips/w83781d.c:715: warning: `old3' might be used uninitialized in this function
>   

It is because old3 is only referenced if:

 ((data->type != w83781d) && data->type != as99127f)

as those two chips don't have extended divisor bits ...

It is however set in the first occurrence:

---------------------------------------------------------------------
       /* w83781d and as99127f don't have extended divisor bits */
       if ((data->type != w83781d) && data->type != as99127f) {
               old3 = w83781d_read_value(client, W83781D_REG_VBAT);
       }
---------------------------------------------------------------------

and thus is rather gcc being brain dead for not being able to figure
old3 is only used within a if block like that.

I was not sure about style policy in a case like this, so I left it as
is, it should however be possible to 'fix' it with:


--- 1/drivers/i2c/chips/w83781d.c	2003-04-09 08:16:08.000000000 +0200
+++ 2/drivers/i2c/chips/w83781d.c	2003-04-09 08:16:22.000000000 +0200
@@ -712,7 +712,7 @@
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct w83781d_data *data = i2c_get_clientdata(client);
-	u32 val, old, old2, old3;
+	u32 val, old, old2, old3 = 0;
 
 	val = simple_strtoul(buf, NULL, 10);
 	old = w83781d_read_value(client, W83781D_REG_VID_FANDIV);


Regards,

-- 
Martin Schlemmer



  reply	other threads:[~2003-04-09  6:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-07 21:16 [PATCH-2.5] Fix w83781d sensor to use Milli-Volt for in_* in sysfs Martin Schlemmer
2003-04-07 21:54 ` Greg KH
2003-04-08  4:11   ` Martin Schlemmer
2003-04-08 22:04     ` Greg KH
2003-04-09  6:18       ` Martin Schlemmer [this message]
2003-04-09  7:41         ` Greg KH
2003-04-08 22:11   ` Martin Schlemmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1049869101.2754.31.camel@workshop.saharact.lan \
    --to=azarah@gentoo.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sensors@Stimpy.netroedge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox