kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info'
@ 2019-08-31 13:03 YueHaibing
  2019-09-01 13:04 ` walter harms
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: YueHaibing @ 2019-08-31 13:03 UTC (permalink / raw)
  To: Don Brace, James E.J. Bottomley, Murthy Bhat, Martin K. Petersen
  Cc: YueHaibing, esc.storagedev, linux-scsi, linux-kernel,
	kernel-janitors, Hulk Robot

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

drivers/scsi/smartpqi/smartpqi_init.c: In function 'pqi_driver_version_show':
drivers/scsi/smartpqi/smartpqi_init.c:6164:24: warning:
 variable 'ctrl_info' set but not used [-Wunused-but-set-variable]

commit 6d90615f1346 ("scsi: smartpqi: add sysfs entries") add it but never
use, so remove it also variable 'shost'

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index ea5409bebf57..b9e7dabee1e5 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -6160,12 +6160,6 @@ static ssize_t pqi_firmware_version_show(struct device *dev,
 static ssize_t pqi_driver_version_show(struct device *dev,
 	struct device_attribute *attr, char *buffer)
 {
-	struct Scsi_Host *shost;
-	struct pqi_ctrl_info *ctrl_info;
-
-	shost = class_to_shost(dev);
-	ctrl_info = shost_to_hba(shost);
-
 	return snprintf(buffer, PAGE_SIZE,
 		"%s\n", DRIVER_VERSION BUILD_TIMESTAMP);
 }

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

* Re: [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info'
  2019-08-31 13:03 [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info' YueHaibing
@ 2019-09-01 13:04 ` walter harms
  2019-09-03  7:48 ` Yuehaibing
  2019-10-01  2:38 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: walter harms @ 2019-09-01 13:04 UTC (permalink / raw)
  To: kernel-janitors



Am 31.08.2019 15:03, schrieb YueHaibing:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/scsi/smartpqi/smartpqi_init.c: In function 'pqi_driver_version_show':
> drivers/scsi/smartpqi/smartpqi_init.c:6164:24: warning:
>  variable 'ctrl_info' set but not used [-Wunused-but-set-variable]
> 
> commit 6d90615f1346 ("scsi: smartpqi: add sysfs entries") add it but never
> use, so remove it also variable 'shost'
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/scsi/smartpqi/smartpqi_init.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
> index ea5409bebf57..b9e7dabee1e5 100644
> --- a/drivers/scsi/smartpqi/smartpqi_init.c
> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
> @@ -6160,12 +6160,6 @@ static ssize_t pqi_firmware_version_show(struct device *dev,
>  static ssize_t pqi_driver_version_show(struct device *dev,
>  	struct device_attribute *attr, char *buffer)
>  {
> -	struct Scsi_Host *shost;
> -	struct pqi_ctrl_info *ctrl_info;
> -
> -	shost = class_to_shost(dev);
> -	ctrl_info = shost_to_hba(shost);
> -
>  	return snprintf(buffer, PAGE_SIZE,
>  		"%s\n", DRIVER_VERSION BUILD_TIMESTAMP);
>  }
> 

so, only snprintf() is left. That begs an other question:
Is that function need at all or can it be replaced with snprintf() ?

re,
 wh

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

* Re: [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info'
  2019-08-31 13:03 [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info' YueHaibing
  2019-09-01 13:04 ` walter harms
@ 2019-09-03  7:48 ` Yuehaibing
  2019-10-01  2:38 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Yuehaibing @ 2019-09-03  7:48 UTC (permalink / raw)
  To: kernel-janitors

On 2019/9/1 21:04, walter harms wrote:
> 
> 
> Am 31.08.2019 15:03, schrieb YueHaibing:
>> Fixes gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/scsi/smartpqi/smartpqi_init.c: In function 'pqi_driver_version_show':
>> drivers/scsi/smartpqi/smartpqi_init.c:6164:24: warning:
>>  variable 'ctrl_info' set but not used [-Wunused-but-set-variable]
>>
>> commit 6d90615f1346 ("scsi: smartpqi: add sysfs entries") add it but never
>> use, so remove it also variable 'shost'
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  drivers/scsi/smartpqi/smartpqi_init.c | 6 ------
>>  1 file changed, 6 deletions(-)
>>
>> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
>> index ea5409bebf57..b9e7dabee1e5 100644
>> --- a/drivers/scsi/smartpqi/smartpqi_init.c
>> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
>> @@ -6160,12 +6160,6 @@ static ssize_t pqi_firmware_version_show(struct device *dev,
>>  static ssize_t pqi_driver_version_show(struct device *dev,
>>  	struct device_attribute *attr, char *buffer)
>>  {
>> -	struct Scsi_Host *shost;
>> -	struct pqi_ctrl_info *ctrl_info;
>> -
>> -	shost = class_to_shost(dev);
>> -	ctrl_info = shost_to_hba(shost);
>> -
>>  	return snprintf(buffer, PAGE_SIZE,
>>  		"%s\n", DRIVER_VERSION BUILD_TIMESTAMP);
>>  }
>>
> 
> so, only snprintf() is left. That begs an other question:
> Is that function need at all or can it be replaced with snprintf() ?

No, pqi_driver_version_show is used as below:

static DEVICE_ATTR(driver_version, 0444, pqi_driver_version_show, NULL);

so seems it cannot be removed.

> 
> re,
>  wh
> 
> 
> 

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

* Re: [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info'
  2019-08-31 13:03 [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info' YueHaibing
  2019-09-01 13:04 ` walter harms
  2019-09-03  7:48 ` Yuehaibing
@ 2019-10-01  2:38 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2019-10-01  2:38 UTC (permalink / raw)
  To: YueHaibing
  Cc: Don Brace, James E.J. Bottomley, Murthy Bhat, Martin K. Petersen,
	esc.storagedev, linux-scsi, linux-kernel, kernel-janitors,
	Hulk Robot


YueHaibing,

> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/scsi/smartpqi/smartpqi_init.c: In function 'pqi_driver_version_show':
> drivers/scsi/smartpqi/smartpqi_init.c:6164:24: warning:
>  variable 'ctrl_info' set but not used [-Wunused-but-set-variable]

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2019-10-01  2:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-31 13:03 [PATCH -next] scsi: smartpqi: remove set but not used variable 'ctrl_info' YueHaibing
2019-09-01 13:04 ` walter harms
2019-09-03  7:48 ` Yuehaibing
2019-10-01  2:38 ` Martin K. Petersen

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).