Skip to contentSkip to conversation

scsi:Replace printk and WARN_ON with WARN macro

PATCH In review Prabhakar Pujeri 2 participants 2 messages Jun 24, 2024 – Jun 25, 2024 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi:Replace printk and WARN_ON with WARN macro

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.

---
 drivers/scsi/initio.c   | 3 +--
 drivers/scsi/scsi_lib.c | 5 +++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/initio.c +1 -2
index 625fd547ee60..39273457f5bd 100644
@@ -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;
 	}
drivers/scsi/scsi_lib.c +3 -2
index ec39acc986d6..54a4122c93f0 100644
@@ -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;
 	}
 
Signature · 1 line
2.45.2
maintainer
#1 lore raw
Quoted 3 lines · Prabhakar Pujeri

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.

Although this patch does exactly what it says, we have a problem applying it in that the initio driver is now so old that almost no-one has hardware for it. As a result we're very reluctant to touch this driver for anything other than critical fixes in case we accidentally break it and no-one notices for months.

Regards,

James Bottomley