diff mbox series

scsi: 53c700: call NCR_700_internal_bus_reset() unconditionally

Message ID 20240325122418.27693-1-adiupina@astralinux.ru
State New
Headers show
Series scsi: 53c700: call NCR_700_internal_bus_reset() unconditionally | expand

Commit Message

Alexandra Diupina March 25, 2024, 12:24 p.m. UTC
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 mbox series

Patch

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