[PATCH v10 2/3] scsi: sd: Remove redundant printk after kmalloc failure

Abinash Singh posted 3 patches 1 month, 1 week ago
[PATCH v10 2/3] scsi: sd: Remove redundant printk after kmalloc failure
Posted by Abinash Singh 1 month, 1 week ago
The SCSI disk driver prints a warning when kmalloc() fails in
sd_revalidate_disk(). This is redundant because the page allocator
already reports failures unless __GFP_NOWARN is used. Keeping the
extra message only adds noise to the kernel log.

Remove the unnecessary sd_printk() call. Control flow is unchanged.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com>
---
 drivers/scsi/sd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index bf12e23f1212..35856685d7fa 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3716,11 +3716,8 @@ static int sd_revalidate_disk(struct gendisk *disk)
 		goto out;
 
 	buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL);
-	if (!buffer) {
-		sd_printk(KERN_WARNING, sdkp, "sd_revalidate_disk: Memory "
-			  "allocation failure.\n");
+	if (!buffer)
 		goto out;
-	}
 
 	sd_spinup_disk(sdkp);
 
-- 
2.43.0
Re: [PATCH v10 2/3] scsi: sd: Remove redundant printk after kmalloc failure
Posted by Bart Van Assche 1 month, 1 week ago
On 8/25/25 11:39 AM, Abinash Singh wrote:
> Remove the unnecessary sd_printk() call. Control flow is unchanged.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>