[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <91f0fb20-1313-47c6-b40f-65520cd8c85b@kernel.org>
Date: Mon, 25 Aug 2025 10:58:13 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Abinash Singh <abinashsinghlalotra@...il.com>, bvanassche@....org
Cc: James.Bottomley@...senPartnership.com, linux-kernel@...r.kernel.org,
linux-scsi@...r.kernel.org, martin.petersen@...cle.com
Subject: Re: [PATCH v9 3/3] scsi: sd: make sd_revalidate_disk() return void
On 8/25/25 3:02 AM, Abinash Singh wrote:
> The sd_revalidate_disk() function currently returns 0 for
> both success and memory allocation failure.Since none of its
> callers use the return value, this return code is both unnecessary
> and potentially misleading.
>
> Change the return type of sd_revalidate_disk() from int to void
> and remove all return value handling. This makes the function
> semantics clearer and avoids confusion about unused return codes.
>
> Signed-off-by: Abinash Singh <abinashsinghlalotra@...il.com>
> Reviewed-by: Bart Van Assche <bvanassche@....org>
> ---
> drivers/scsi/sd.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 35856685d7fa..b3926c43e700 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -106,7 +106,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, struct queue_limits *lim,
> unsigned int mode);
> static void sd_config_write_same(struct scsi_disk *sdkp,
> struct queue_limits *lim);
> -static int sd_revalidate_disk(struct gendisk *);
> +static void sd_revalidate_disk(struct gendisk *);
> static void sd_unlock_native_capacity(struct gendisk *disk);
> static void sd_shutdown(struct device *);
> static void scsi_disk_release(struct device *cdev);
> @@ -3691,7 +3691,7 @@ static void sd_read_block_zero(struct scsi_disk *sdkp)
> * performs disk spin up, read_capacity, etc.
> * @disk: struct gendisk we care about
> **/
> -static int sd_revalidate_disk(struct gendisk *disk)
> +static void sd_revalidate_disk(struct gendisk *disk)
> {
> struct scsi_disk *sdkp = scsi_disk(disk);
> struct scsi_device *sdp = sdkp->device;
> @@ -3699,7 +3699,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
> struct queue_limits *lim = NULL;
> unsigned char *buffer = NULL;
> unsigned int dev_max;
> - int err = 0;
> + int err;
>
> SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp,
> "sd_revalidate_disk\n"));
> @@ -3709,11 +3709,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
> * of the other niceties.
> */
> if (!scsi_device_online(sdp))
> - goto out;
> + return;
>
> lim = kmalloc(sizeof(*lim), GFP_KERNEL);
> if (!lim)
> - goto out;
> + return;
>
> buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL);
> if (!buffer)
OK. So you can ignore the nit I commented on patch 1.
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@...nel.org>
> @@ -3823,7 +3823,6 @@ static int sd_revalidate_disk(struct gendisk *disk)
> kfree(buffer);
> kfree(lim);
>
> - return err;
> }
>
> /**
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists