Re: [lm-sensors] [PATCH] hwmon: Driver for Texas Instruments amc6821 chip

From: Andrew Morton
Date: Wed Sep 09 2009 - 04:07:23 EST


On Wed, 9 Sep 2009 09:34:35 +0200 Jean Delvare <khali@xxxxxxxxxxxx> wrote:

> > Also, the checkpatch warning
> >
> > WARNING: consider using strict_strtol in preference to simple_strtol
> > #381: FILE: drivers/hwmon/amc6821.c:228:
> > + int val = simple_strtol(buf, NULL, 10); \
> >
> > is valid. The problem with simple_strtol() is that it will treat input
> > of the form "43foo" as "43". Even though the input was invalid. A
> > minor thing, but easily fixed too.
>
> Is there any legitimate use of simple_strtol then?

Probably not, unless it's known that the input is a legit decimal
string.

> I'm wondering why we
> don't just get rid of it and rename strict_strtol to just strtol.

Well. The calling convention is pretty different, the callers need to
be changed to handle errors. But the main problem is that changing
existing interfaces to use strict_strtol() could break existing
userspace.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/