All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] Convert simple_strtoul to kstrtoul
@ 2015-02-20 14:16 Navya Sri Nizamkari
  2015-02-26 21:48 ` [Outreachy kernel] " Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-20 14:16 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Navya Sri Nizamkari

This patch fixes the checkpatch.pl warning:
simple_strtoul is obsolete, use kstrtoul instead.

Replaced simple_strtoul with kstrtoul as both can perform parsing error
checks on the string to the converted. The parsing error condition for
simple_strtoul is that the string to be converted is same as the converted
string, with kstrtoul the return value is non-zero in case of this error.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v4:
    -Updated commit explanation to be more generic.

 drivers/staging/media/parport/bw-qcam.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/media/parport/bw-qcam.c b/drivers/staging/media/parport/bw-qcam.c
index 67b9da1..6c9b400 100644
--- a/drivers/staging/media/parport/bw-qcam.c
+++ b/drivers/staging/media/parport/bw-qcam.c
@@ -1106,10 +1106,8 @@ static int accept_bwqcam(struct parport *port)
 	if (parport[0] && strncmp(parport[0], "auto", 4) != 0) {
 		/* user gave parport parameters */
 		for (n = 0; n < MAX_CAMS && parport[n]; n++) {
-			char *ep;
 			unsigned long r;
-			r = simple_strtoul(parport[n], &ep, 0);
-			if (ep == parport[n]) {
+			if (kstrtoul(parport[n], 0, &r)) {
 				printk(KERN_ERR
 					"bw-qcam: bad port specifier \"%s\"\n",
 					parport[n]);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy kernel] [PATCH v4] Convert simple_strtoul to kstrtoul
  2015-02-20 14:16 [PATCH v4] Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
@ 2015-02-26 21:48 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-02-26 21:48 UTC (permalink / raw)
  To: Navya Sri Nizamkari; +Cc: outreachy-kernel

On Fri, Feb 20, 2015 at 07:46:16PM +0530, Navya Sri Nizamkari wrote:
> This patch fixes the checkpatch.pl warning:
> simple_strtoul is obsolete, use kstrtoul instead.
> 
> Replaced simple_strtoul with kstrtoul as both can perform parsing error
> checks on the string to the converted. The parsing error condition for
> simple_strtoul is that the string to be converted is same as the converted
> string, with kstrtoul the return value is non-zero in case of this error.
> 
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
> ---
> Changes in v4:
>     -Updated commit explanation to be more generic.
> 
>  drivers/staging/media/parport/bw-qcam.c | 4 +---

This file is no longer in Linus's tree :(


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-26 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20 14:16 [PATCH v4] Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
2015-02-26 21:48 ` [Outreachy kernel] " Greg KH

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.