diff mbox series

scsi:Replace printk and WARN_ON with WARN macro

Message ID 20240624173205.1227297-1-prabhakar.pujeri@gmail.com
State New
Headers show
Series scsi:Replace printk and WARN_ON with WARN macro | expand

Commit Message

prabhakar pujeri June 24, 2024, 5:32 p.m. UTC
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@gmail.com>
---
 drivers/scsi/initio.c   | 3 +--
 drivers/scsi/scsi_lib.c | 5 +++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

James Bottomley June 25, 2024, 2:50 a.m. UTC | #1
On Mon, 2024-06-24 at 13:32 -0400, Prabhakar Pujeri wrote:
> 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
diff mbox series

Patch

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;
 	}