mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi:Replace printk and WARN_ON with WARN macro
@ 2024-06-24 17:32 Prabhakar Pujeri
  2024-06-25  2:50 ` James Bottomley
  0 siblings, 1 reply; 2+ messages in thread
From: Prabhakar Pujeri @ 2024-06-24 17:32 UTC (permalink / raw)
  To: linux-scsi, linux-kernel; +Cc: 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.

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(-)

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi:Replace printk and WARN_ON with WARN macro
  2024-06-24 17:32 [PATCH] scsi:Replace printk and WARN_ON with WARN macro Prabhakar Pujeri
@ 2024-06-25  2:50 ` James Bottomley
  0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2024-06-25  2:50 UTC (permalink / raw)
  To: Prabhakar Pujeri, linux-scsi, linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-25  2:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 17:32 [PATCH] scsi:Replace printk and WARN_ON with WARN macro Prabhakar Pujeri
2024-06-25  2:50 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®