diff mbox series

[-next] ide-cd: fix warning: variable 'stat' set but not used

Message ID 20210529061729.2824082-1-libaokun1@huawei.com
State New
Headers show
Series [-next] ide-cd: fix warning: variable 'stat' set but not used | expand

Commit Message

Baokun Li May 29, 2021, 6:17 a.m. UTC
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
drivers/ide/ide-cd_ioctl.c:212:6: warning:
 variable ‘stat’ set but not used [-Wunused-but-set-variable]

It never used since introduction.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 drivers/ide/ide-cd_ioctl.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Baokun Li June 15, 2021, 1:59 a.m. UTC | #1
ping

在 2021/5/29 14:17, Baokun Li 写道:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
> drivers/ide/ide-cd_ioctl.c:212:6: warning:
>   variable ‘stat’ set but not used [-Wunused-but-set-variable]
>
> It never used since introduction.
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
>   drivers/ide/ide-cd_ioctl.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c
> index 011eab9c69b7..8d0a52123349 100644
> --- a/drivers/ide/ide-cd_ioctl.c
> +++ b/drivers/ide/ide-cd_ioctl.c
> @@ -231,6 +231,8 @@ int ide_cdrom_select_speed(struct cdrom_device_info *cdi, int speed)
>   	}
>   
>   	stat = ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, NULL, 0, 0);
> +	if (stat)
> +		return stat;
>   
>   	if (!ide_cdrom_get_capabilities(drive, buf)) {
>   		ide_cdrom_update_speed(drive, buf);
Jens Axboe June 15, 2021, 9:45 p.m. UTC | #2
On 5/29/21 12:17 AM, Baokun Li wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
> drivers/ide/ide-cd_ioctl.c:212:6: warning:
>  variable ‘stat’ set but not used [-Wunused-but-set-variable]
> 
> It never used since introduction.

This code is being removed shortly, so better to just leave it alone.
Baokun Li June 16, 2021, 1:05 a.m. UTC | #3
Thank you for your reminder.

Best Regards.


在 2021/6/16 5:45, Jens Axboe 写道:
> On 5/29/21 12:17 AM, Baokun Li wrote:
>> Fixes gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
>> drivers/ide/ide-cd_ioctl.c:212:6: warning:
>>   variable ‘stat’ set but not used [-Wunused-but-set-variable]
>>
>> It never used since introduction.
> This code is being removed shortly, so better to just leave it alone.
>
diff mbox series

Patch

diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c
index 011eab9c69b7..8d0a52123349 100644
--- a/drivers/ide/ide-cd_ioctl.c
+++ b/drivers/ide/ide-cd_ioctl.c
@@ -231,6 +231,8 @@  int ide_cdrom_select_speed(struct cdrom_device_info *cdi, int speed)
 	}
 
 	stat = ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, NULL, 0, 0);
+	if (stat)
+		return stat;
 
 	if (!ide_cdrom_get_capabilities(drive, buf)) {
 		ide_cdrom_update_speed(drive, buf);