From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: Add missing parentheses
Date: Wed, 18 Feb 2009 13:17:41 +0000 [thread overview]
Message-ID: <20090218141741.0e747c59@hyperion.delvare> (raw)
In-Reply-To: <499AB902.1080308@gmail.com>
On Tue, 17 Feb 2009 21:03:23 +0000, Alistair John Strachan wrote:
> On Tuesday 17 February 2009 13:17:54 Roel Kluin wrote:
> > I think this was intended? please review.
>
> This one's been there from the beginning.
>
> The change looks right to me. (i * count) account the previous successes, add
> either zero or x depending on the kind of read failure (timeout/short read vs
> other I/O error). I'm not entirely sure why i must be >0 for accounting the
> short read.
I can't make any sense of that "i &&" either. Hans?
> Nothing calling abituguru3_read_increment_offset() checks for anything other
> than complete success. Every caller passes count=1, and offset_count>1, so
> both the new code and the old could never return a full count
> (offset_count*count) when an error has occured (old returns either 0 or x,
> x=count). Ergo, the change can't cause any regressions.
>
> Acked-by: Alistair John Strachan <alistair@devzero.co.uk>
>
> Jean, are you happy to take this?
Yes, but I'd like to understand why the "i &&" is there, and if there's
no good reason we should drop it.
> > --------------------------->8-------------8<------------------------------
> > Add missing parentheses
> >
> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> > ---
> > diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
> > index e52b388..fd98685 100644
> > --- a/drivers/hwmon/abituguru3.c
> > +++ b/drivers/hwmon/abituguru3.c
> > @@ -761,7 +761,7 @@ static int abituguru3_read_increment_offset(struct
> > abituguru3_data *data, for (i = 0; i < offset_count; i++)
> > if ((x = abituguru3_read(data, bank, offset + i, count,
> > buf + i * count)) != count)
> > - return i * count + (i && (x < 0)) ? 0 : x;
> > + return i * count + ((i && (x < 0)) ? 0 : x);
> >
> > return i * count;
> > }
>
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2009-02-18 13:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-17 13:17 [lm-sensors] [PATCH] hwmon: Add missing parentheses Roel Kluin
2009-02-17 21:03 ` Alistair John Strachan
2009-02-18 13:17 ` Jean Delvare [this message]
2009-02-18 14:25 ` Hans de Goede
2009-02-18 15:15 ` Jean Delvare
2009-02-18 15:15 ` Hans de Goede
2009-02-19 9:13 ` alistair
2009-02-19 9:28 ` Hans de Goede
2009-02-19 9:41 ` Jean Delvare
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=20090218141741.0e747c59@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.