lkml.org 
[lkml]   [2020]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
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
>

\
 
 \ /
  Last update: 2020-03-12 15:38    [W:1.528 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site