All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Convert simple_strtoul to kstrtoul
@ 2015-02-19 17:34 Navya Sri Nizamkari
  2015-02-19 17:39 ` [Outreachy kernel] " Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Navya Sri Nizamkari @ 2015-02-19 17:34 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Navya Sri Nizamkari

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

When the string is not converted(parsing error),the strings pointed to by ep and parport[n] are the same.This parsing error results in kstrtoul returning a non-zero value.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
    -Added a descriptive commit message.

 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..1b81244 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] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH v2] Convert simple_strtoul to kstrtoul
  2015-02-19 17:34 [PATCH v2] Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
@ 2015-02-19 17:39 ` Laurent Pinchart
  2015-02-19 17:42   ` navya sri nizamkari
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2015-02-19 17:39 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Navya Sri Nizamkari

Hi Navya,

Thank you for the patch.

On Thursday 19 February 2015 23:04:59 Navya Sri Nizamkari wrote:
> This patch fixes the checkpatch.pl warning:
> simple_strtoul is obsolete, use kstrtoul instead.
> 
> When the string is not converted(parsing error),the strings pointed to by ep
> and parport[n] are the same.This parsing error results in kstrtoul
> returning a non-zero value.
> 
> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
> ---
> Changes in v2:
>     -Added a descriptive commit message.
> 
>  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..1b81244 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)) {

It's nice to fix checkpatch warnings, but not if you introduce new ones. If 
you run checkpatch on your patch you should get warnings regarding missing 
spaces after commas. As a general rule, you should always run checkpatch on 
all patches you want to submit for review before sending them to mailing 
lists.

>  				printk(KERN_ERR
>  					"bw-qcam: bad port specifier \"%s\"\n",
>  					parport[n]);

-- 
Regards,

Laurent Pinchart



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

* Re: [Outreachy kernel] [PATCH v2] Convert simple_strtoul to kstrtoul
  2015-02-19 17:39 ` [Outreachy kernel] " Laurent Pinchart
@ 2015-02-19 17:42   ` navya sri nizamkari
  0 siblings, 0 replies; 3+ messages in thread
From: navya sri nizamkari @ 2015-02-19 17:42 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: outreachy-kernel, Julia Lawall

I'll send in another patch. I'm not sure if I changed anything in the
printk error message.
Thanks,

Navya

On Thu, Feb 19, 2015 at 11:09 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Navya,
>
> Thank you for the patch.
>
> On Thursday 19 February 2015 23:04:59 Navya Sri Nizamkari wrote:
>> This patch fixes the checkpatch.pl warning:
>> simple_strtoul is obsolete, use kstrtoul instead.
>>
>> When the string is not converted(parsing error),the strings pointed to by ep
>> and parport[n] are the same.This parsing error results in kstrtoul
>> returning a non-zero value.
>>
>> Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
>> ---
>> Changes in v2:
>>     -Added a descriptive commit message.
>>
>>  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..1b81244 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)) {
>
> It's nice to fix checkpatch warnings, but not if you introduce new ones. If
> you run checkpatch on your patch you should get warnings regarding missing
> spaces after commas. As a general rule, you should always run checkpatch on
> all patches you want to submit for review before sending them to mailing
> lists.
>
>>                               printk(KERN_ERR
>>                                       "bw-qcam: bad port specifier \"%s\"\n",
>>                                       parport[n]);
>
> --
> Regards,
>
> Laurent Pinchart
>


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

end of thread, other threads:[~2015-02-19 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-19 17:34 [PATCH v2] Convert simple_strtoul to kstrtoul Navya Sri Nizamkari
2015-02-19 17:39 ` [Outreachy kernel] " Laurent Pinchart
2015-02-19 17:42   ` navya sri nizamkari

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.