Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Abinash Singh and committed by
Martin K. Petersen
11e6fb38 d842da69

+5 -6
+5 -6
drivers/scsi/sd.c
··· 106 106 unsigned int mode); 107 107 static void sd_config_write_same(struct scsi_disk *sdkp, 108 108 struct queue_limits *lim); 109 - static int sd_revalidate_disk(struct gendisk *); 109 + static void sd_revalidate_disk(struct gendisk *); 110 110 static void sd_unlock_native_capacity(struct gendisk *disk); 111 111 static void sd_shutdown(struct device *); 112 112 static void scsi_disk_release(struct device *cdev); ··· 3691 3691 * performs disk spin up, read_capacity, etc. 3692 3692 * @disk: struct gendisk we care about 3693 3693 **/ 3694 - static int sd_revalidate_disk(struct gendisk *disk) 3694 + static void sd_revalidate_disk(struct gendisk *disk) 3695 3695 { 3696 3696 struct scsi_disk *sdkp = scsi_disk(disk); 3697 3697 struct scsi_device *sdp = sdkp->device; ··· 3699 3699 struct queue_limits *lim = NULL; 3700 3700 unsigned char *buffer = NULL; 3701 3701 unsigned int dev_max; 3702 - int err = 0; 3702 + int err; 3703 3703 3704 3704 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, 3705 3705 "sd_revalidate_disk\n")); ··· 3709 3709 * of the other niceties. 3710 3710 */ 3711 3711 if (!scsi_device_online(sdp)) 3712 - goto out; 3712 + return; 3713 3713 3714 3714 lim = kmalloc(sizeof(*lim), GFP_KERNEL); 3715 3715 if (!lim) 3716 - goto out; 3716 + return; 3717 3717 3718 3718 buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL); 3719 3719 if (!buffer) ··· 3823 3823 kfree(buffer); 3824 3824 kfree(lim); 3825 3825 3826 - return err; 3827 3826 } 3828 3827 3829 3828 /**