Re: [PATCH v2] Input: convert obsolete strict_strtox to kstrtox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 07, 2011 at 07:59:30PM -0800, Dmitry Torokhov wrote:
> On Mon, Nov 07, 2011 at 07:54:50PM +0800, JJ Ding wrote:
> > From: JJ Ding <dgdunix@xxxxxxxxx>
> > 
> > With commit 67d0a0754455f89ef3946946159d8ec9e45ce33a we mark strict_strtox
> > as obsolete. Convert all remaining such uses in drivers/input/.
> > 
> > Also change the data type from long to int as Dmitry sugguests, we now have
> > kstrtouint which suits these uses better.
> > 
> 
> Applied, thanks JJ.
> 

Sorry, I take it back...

> -       if (strict_strtoul(buf, 10, &value) || value > 1)
> +       if (kstrtouint(buf, 10, &value) || value > 1)
>                 return -EINVAL;

This mangles error condition from kstrtouint and reporting conditions
beside -EINVAL was the reason for introducing new API IIRC. The proper
conversion should be:

	err = kstrtouint(buf, 10, &value);
	if (err)
		return err;

	if (value > 1)
		return -EINVAL;

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux