linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
@ 2020-03-12 14:04 Chen Zhou
  2020-03-12 14:38 ` Bjorn Helgaas
  2020-03-26 12:06 ` Michael Ellerman
  0 siblings, 2 replies; 6+ messages in thread
From: Chen Zhou @ 2020-03-12 14:04 UTC (permalink / raw)
  To: paulus, mpe, tyreld, bhelgaas
  Cc: linuxppc-dev, linux-pci, linux-kernel, chenzhou10

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
	variable value set but not used [-Wunused-but-set-variable]

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
 drivers/pci/hotplug/rpaphp_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index e408e40..5d871ef 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -288,11 +288,10 @@ EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);
 
 static int is_php_type(char *drc_type)
 {
-	unsigned long value;
 	char *endptr;
 
 	/* PCI Hotplug nodes have an integer for drc_type */
-	value = simple_strtoul(drc_type, &endptr, 10);
+	simple_strtoul(drc_type, &endptr, 10);
 	if (endptr == drc_type)
 		return 0;
 
-- 
2.7.4


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

* Re: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
  2020-03-12 14:04 [PATCH -next] PCI: rpaphp: remove set but not used variable 'value' Chen Zhou
@ 2020-03-12 14:38 ` Bjorn Helgaas
  2020-03-12 14:41   ` Bjorn Helgaas
  2020-03-26 12:06 ` Michael Ellerman
  1 sibling, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2020-03-12 14:38 UTC (permalink / raw)
  To: Chen Zhou; +Cc: paulus, mpe, tyreld, linuxppc-dev, linux-pci, linux-kernel

On Thu, Mar 12, 2020 at 10:04:12PM +0800, Chen Zhou wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
> drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
> 	variable value set but not used [-Wunused-but-set-variable]
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Chen Zhou <chenzhou10@huawei.com>

Michael, if you want this:

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

If you don't mind, edit the subject to follow the convention, e.g.,

  PCI: rpaphp: Remove unused variable 'value'

Apparently simple_strtoul() is deprecated and we're supposed to use
kstrtoul() instead.  Looks like kstrtoul() might simplify the code a
little, too, e.g.,

  if (kstrtoul(drc_type, 0, &value) == 0)
    return 1;

  return 0;

> ---
>  drivers/pci/hotplug/rpaphp_core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> index e408e40..5d871ef 100644
> --- a/drivers/pci/hotplug/rpaphp_core.c
> +++ b/drivers/pci/hotplug/rpaphp_core.c
> @@ -288,11 +288,10 @@ EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);
>  
>  static int is_php_type(char *drc_type)
>  {
> -	unsigned long value;
>  	char *endptr;
>  
>  	/* PCI Hotplug nodes have an integer for drc_type */
> -	value = simple_strtoul(drc_type, &endptr, 10);
> +	simple_strtoul(drc_type, &endptr, 10);
>  	if (endptr == drc_type)
>  		return 0;
>  
> -- 
> 2.7.4
> 

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

* Re: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
  2020-03-12 14:38 ` Bjorn Helgaas
@ 2020-03-12 14:41   ` Bjorn Helgaas
  2020-03-12 21:36     ` Tyrel Datwyler
  2020-03-13 10:43     ` Michael Ellerman
  0 siblings, 2 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2020-03-12 14:41 UTC (permalink / raw)
  To: Chen Zhou; +Cc: paulus, mpe, tyreld, linuxppc-dev, linux-pci, linux-kernel

On Thu, Mar 12, 2020 at 09:38:02AM -0500, Bjorn Helgaas wrote:
> On Thu, Mar 12, 2020 at 10:04:12PM +0800, Chen Zhou wrote:
> > Fixes gcc '-Wunused-but-set-variable' warning:
> > 
> > drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
> > drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
> > 	variable value set but not used [-Wunused-but-set-variable]
> > 
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
> 
> Michael, if you want this:
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> If you don't mind, edit the subject to follow the convention, e.g.,
> 
>   PCI: rpaphp: Remove unused variable 'value'
> 
> Apparently simple_strtoul() is deprecated and we're supposed to use
> kstrtoul() instead.  Looks like kstrtoul() might simplify the code a
> little, too, e.g.,
> 
>   if (kstrtoul(drc_type, 0, &value) == 0)
>     return 1;
> 
>   return 0;

I guess there are several other uses of simple_strtoul() in this file.
Not sure if it's worth changing them all, just this one, or just the
patch below as-is.

> > ---
> >  drivers/pci/hotplug/rpaphp_core.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> > index e408e40..5d871ef 100644
> > --- a/drivers/pci/hotplug/rpaphp_core.c
> > +++ b/drivers/pci/hotplug/rpaphp_core.c
> > @@ -288,11 +288,10 @@ EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);
> >  
> >  static int is_php_type(char *drc_type)
> >  {
> > -	unsigned long value;
> >  	char *endptr;
> >  
> >  	/* PCI Hotplug nodes have an integer for drc_type */
> > -	value = simple_strtoul(drc_type, &endptr, 10);
> > +	simple_strtoul(drc_type, &endptr, 10);
> >  	if (endptr == drc_type)
> >  		return 0;
> >  
> > -- 
> > 2.7.4
> > 

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

* Re: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
  2020-03-12 14:41   ` Bjorn Helgaas
@ 2020-03-12 21:36     ` Tyrel Datwyler
  2020-03-13 10:43     ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Tyrel Datwyler @ 2020-03-12 21:36 UTC (permalink / raw)
  To: Bjorn Helgaas, Chen Zhou
  Cc: paulus, mpe, linuxppc-dev, linux-pci, linux-kernel

On 3/12/20 7:41 AM, Bjorn Helgaas wrote:
> On Thu, Mar 12, 2020 at 09:38:02AM -0500, Bjorn Helgaas wrote:
>> On Thu, Mar 12, 2020 at 10:04:12PM +0800, Chen Zhou wrote:
>>> Fixes gcc '-Wunused-but-set-variable' warning:
>>>
>>> drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
>>> drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
>>> 	variable value set but not used [-Wunused-but-set-variable]
>>>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>> Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
>>
>> Michael, if you want this:
>>
>> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>>
>> If you don't mind, edit the subject to follow the convention, e.g.,
>>
>>   PCI: rpaphp: Remove unused variable 'value'
>>
>> Apparently simple_strtoul() is deprecated and we're supposed to use
>> kstrtoul() instead.  Looks like kstrtoul() might simplify the code a
>> little, too, e.g.,
>>
>>   if (kstrtoul(drc_type, 0, &value) == 0)
>>     return 1;
>>
>>   return 0;
> 
> I guess there are several other uses of simple_strtoul() in this file.
> Not sure if it's worth changing them all, just this one, or just the
> patch below as-is.

If we are going to change one might as well do them all at once. If the original
submitter wants to send the follow up that is fine, or I can send a patch when I
have a minute.

-Tyrel

> 
>>> ---
>>>  drivers/pci/hotplug/rpaphp_core.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
>>> index e408e40..5d871ef 100644
>>> --- a/drivers/pci/hotplug/rpaphp_core.c
>>> +++ b/drivers/pci/hotplug/rpaphp_core.c
>>> @@ -288,11 +288,10 @@ EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);
>>>  
>>>  static int is_php_type(char *drc_type)
>>>  {
>>> -	unsigned long value;
>>>  	char *endptr;
>>>  
>>>  	/* PCI Hotplug nodes have an integer for drc_type */
>>> -	value = simple_strtoul(drc_type, &endptr, 10);
>>> +	simple_strtoul(drc_type, &endptr, 10);
>>>  	if (endptr == drc_type)
>>>  		return 0;
>>>  
>>> -- 
>>> 2.7.4
>>>


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

* Re: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
  2020-03-12 14:41   ` Bjorn Helgaas
  2020-03-12 21:36     ` Tyrel Datwyler
@ 2020-03-13 10:43     ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2020-03-13 10:43 UTC (permalink / raw)
  To: Bjorn Helgaas, Chen Zhou
  Cc: paulus, tyreld, linuxppc-dev, linux-pci, linux-kernel

Bjorn Helgaas <helgaas@kernel.org> writes:
> On Thu, Mar 12, 2020 at 09:38:02AM -0500, Bjorn Helgaas wrote:
>> On Thu, Mar 12, 2020 at 10:04:12PM +0800, Chen Zhou wrote:
>> > Fixes gcc '-Wunused-but-set-variable' warning:
>> > 
>> > drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
>> > drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
>> > 	variable value set but not used [-Wunused-but-set-variable]
>> > 
>> > Reported-by: Hulk Robot <hulkci@huawei.com>
>> > Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
>> 
>> Michael, if you want this:
>> 
>> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>> 
>> If you don't mind, edit the subject to follow the convention, e.g.,
>> 
>>   PCI: rpaphp: Remove unused variable 'value'
>> 
>> Apparently simple_strtoul() is deprecated and we're supposed to use
>> kstrtoul() instead.  Looks like kstrtoul() might simplify the code a
>> little, too, e.g.,
>> 
>>   if (kstrtoul(drc_type, 0, &value) == 0)
>>     return 1;
>> 
>>   return 0;
>
> I guess there are several other uses of simple_strtoul() in this file.
> Not sure if it's worth changing them all, just this one, or just the
> patch below as-is.

I'll take this patch as-is, and someone can send a follow-up to convert
the whole file to kstrtoul().

cheers

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

* Re: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
  2020-03-12 14:04 [PATCH -next] PCI: rpaphp: remove set but not used variable 'value' Chen Zhou
  2020-03-12 14:38 ` Bjorn Helgaas
@ 2020-03-26 12:06 ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2020-03-26 12:06 UTC (permalink / raw)
  To: Chen Zhou, paulus, tyreld, bhelgaas
  Cc: chenzhou10, linux-pci, linuxppc-dev, linux-kernel

On Thu, 2020-03-12 at 14:04:12 UTC, Chen Zhou wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
> drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
> 	variable value set but not used [-Wunused-but-set-variable]
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Chen Zhou <chenzhou10@huawei.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/9475af081ec1fb6cc794a17ae90f2c01aa8a7993

cheers

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

end of thread, other threads:[~2020-03-26 12:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 14:04 [PATCH -next] PCI: rpaphp: remove set but not used variable 'value' Chen Zhou
2020-03-12 14:38 ` Bjorn Helgaas
2020-03-12 14:41   ` Bjorn Helgaas
2020-03-12 21:36     ` Tyrel Datwyler
2020-03-13 10:43     ` Michael Ellerman
2020-03-26 12:06 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).