LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: 53c700: call NCR_700_internal_bus_reset() unconditionally
@ 2024-03-25 12:24 Alexandra Diupina
  0 siblings, 0 replies; only message in thread
From: Alexandra Diupina @ 2024-03-25 12:24 UTC (permalink / raw
  To: James E.J. Bottomley
  Cc: Alexandra Diupina, Martin K. Petersen, linux-scsi, linux-kernel,
	lvc-project

It is necessary to include the SCp check inside the branch
and call NCR_700_internal_bus_reset() unconditionally.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 87fd912d3ba3 ("Add NULL check for SCp in process_script_interrupt()")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
---
The patch makes a change to commit 87fd912d3ba3, which I 
created earlier. It became clear that it is necessary to 
call NCR_700_internal_bus_reset() in this condition branch 
for any value of SCp. Sorry for the incorrect previous patch.
 drivers/scsi/53c700.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index e4fe7fc8dfcb..1a422264160d 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1067,15 +1067,17 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
 			//}
 			NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]);
 		}
-	} else if ((dsps & 0xfffff0f0) == A_UNEXPECTED_PHASE && SCp) {
-		__u8 i = (dsps & 0xf00) >> 8;
-
-		scmd_printk(KERN_ERR, SCp, "UNEXPECTED PHASE %s (%s)\n",
-		       NCR_700_phase[i],
-		       sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
-		scmd_printk(KERN_ERR, SCp, "         len = %d, cmd =",
-			SCp->cmd_len);
-		scsi_print_command(SCp);
+	} else if ((dsps & 0xfffff0f0) == A_UNEXPECTED_PHASE) {
+		if (SCp) {
+			__u8 i = (dsps & 0xf00) >> 8;
+
+			scmd_printk(KERN_ERR, SCp, "UNEXPECTED PHASE %s (%s)\n",
+				NCR_700_phase[i],
+				sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
+			scmd_printk(KERN_ERR, SCp, "         len = %d, cmd =",
+				SCp->cmd_len);
+			scsi_print_command(SCp);
+		}
 
 		NCR_700_internal_bus_reset(host);
 	} else if((dsps & 0xfffff000) == A_FATAL) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-25 12:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 12:24 [PATCH] scsi: 53c700: call NCR_700_internal_bus_reset() unconditionally Alexandra Diupina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).