From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH v2] hwmon: (emc6w201) Fix DIV_ROUND_CLOSEST problem with unsigned divisors
Date: Wed, 19 Dec 2012 16:26:10 +0000 [thread overview]
Message-ID: <20121219162610.GA30418@roeck-us.net> (raw)
In-Reply-To: <1355932908-22131-1-git-send-email-linux@roeck-us.net>
On Wed, Dec 19, 2012 at 05:17:00PM +0100, Jean Delvare wrote:
> Hi Guenter,
>
> On Wed, 19 Dec 2012 08:01:48 -0800, Guenter Roeck wrote:
> > Result of DIV_ROUND_CLOSEST is undefined for negative dividends if the divisor
> > variable type is unsigned. Fix by declaring divisor as signed variable.
> >
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > v2: Fix by changing divisor variable type instead of dividend variable type
> >
> > drivers/hwmon/emc6w201.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c
> > index a98c917..789bd4f 100644
> > --- a/drivers/hwmon/emc6w201.c
> > +++ b/drivers/hwmon/emc6w201.c
> > @@ -187,7 +187,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev)
> > * Sysfs callback functions
> > */
> >
> > -static const u16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };
> > +static const s16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };
> >
> > static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
> > char *buf)
>
> Applied, thanks.
>
Hi Jean,
Can you take the kernel.h patch as well ?
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2012-12-19 16:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-19 16:01 [lm-sensors] [PATCH v2] hwmon: (emc6w201) Fix DIV_ROUND_CLOSEST problem with unsigned divisors Guenter Roeck
2012-12-19 16:17 ` Jean Delvare
2012-12-19 16:26 ` Guenter Roeck [this message]
2012-12-19 16:27 ` Jean Delvare
2012-12-19 21:35 ` Jean Delvare
2012-12-19 22:38 ` Guenter Roeck
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=20121219162610.GA30418@roeck-us.net \
--to=linux@roeck-us.net \
--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.