Skip to content

Commit 11e6fb3

Browse files
avinashlalotramartinkpetersen
authored andcommitted
scsi: sd: Make sd_revalidate_disk() return void
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. Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com> Link: https://lore.kernel.org/r/20250825183940.13211-4-abinashsinghlalotra@gmail.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d842da6 commit 11e6fb3

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

drivers/scsi/sd.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, struct queue_limits *lim,
106106
unsigned int mode);
107107
static void sd_config_write_same(struct scsi_disk *sdkp,
108108
struct queue_limits *lim);
109-
static int sd_revalidate_disk(struct gendisk *);
109+
static void sd_revalidate_disk(struct gendisk *);
110110
static void sd_unlock_native_capacity(struct gendisk *disk);
111111
static void sd_shutdown(struct device *);
112112
static void scsi_disk_release(struct device *cdev);
@@ -3691,15 +3691,15 @@ static void sd_read_block_zero(struct scsi_disk *sdkp)
36913691
* performs disk spin up, read_capacity, etc.
36923692
* @disk: struct gendisk we care about
36933693
**/
3694-
static int sd_revalidate_disk(struct gendisk *disk)
3694+
static void sd_revalidate_disk(struct gendisk *disk)
36953695
{
36963696
struct scsi_disk *sdkp = scsi_disk(disk);
36973697
struct scsi_device *sdp = sdkp->device;
36983698
sector_t old_capacity = sdkp->capacity;
36993699
struct queue_limits *lim = NULL;
37003700
unsigned char *buffer = NULL;
37013701
unsigned int dev_max;
3702-
int err = 0;
3702+
int err;
37033703

37043704
SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp,
37053705
"sd_revalidate_disk\n"));
@@ -3709,11 +3709,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
37093709
* of the other niceties.
37103710
*/
37113711
if (!scsi_device_online(sdp))
3712-
goto out;
3712+
return;
37133713

37143714
lim = kmalloc(sizeof(*lim), GFP_KERNEL);
37153715
if (!lim)
3716-
goto out;
3716+
return;
37173717

37183718
buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL);
37193719
if (!buffer)
@@ -3823,7 +3823,6 @@ static int sd_revalidate_disk(struct gendisk *disk)
38233823
kfree(buffer);
38243824
kfree(lim);
38253825

3826-
return err;
38273826
}
38283827

38293828
/**

0 commit comments

Comments
 (0)