[PATCH] scsi:Replace printk and WARN_ON with WARN macro

From: Prabhakar Pujeri
Date: Mon Jun 24 2024 - 13:32:57 EST


This patch modifies the error handling in the SCSI library and Initio SCSI driver by replacing the combination of printk and WARN_ON macros with the WARN macro for better consistency and readability.

Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@xxxxxxxxx>
---
drivers/scsi/initio.c | 3 +--
drivers/scsi/scsi_lib.c | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 625fd547ee60..39273457f5bd 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2737,8 +2737,7 @@ static void i91uSCBPost(u8 * host_mem, u8 * cblk_mem)
host = (struct initio_host *) host_mem;
cblk = (struct scsi_ctrl_blk *) cblk_mem;
if ((cmnd = cblk->srb) == NULL) {
- printk(KERN_ERR "i91uSCBPost: SRB pointer is empty\n");
- WARN_ON(1);
+ WARN(1,KERN_ERR "i91uSCBPost: SRB pointer is empty\n");
initio_release_scb(host, cblk); /* Release SCB for current channel */
return;
}
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ec39acc986d6..54a4122c93f0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -3117,10 +3117,11 @@ void *scsi_kmap_atomic_sg(struct scatterlist *sgl, int sg_count,
}

if (unlikely(i == sg_count)) {
- printk(KERN_ERR "%s: Bytes in sg: %zu, requested offset %zu, "
+ WARN(1,
+
+ KERN_ERR "%s: Bytes in sg: %zu, requested offset %zu, "
"elements %d\n",
__func__, sg_len, *offset, sg_count);
- WARN_ON(1);
return NULL;
}

--
2.45.2