[PATCH] scsi: 53c700: call NCR_700_internal_bus_reset() unconditionally

From: Alexandra Diupina
Date: Mon Mar 25 2024 - 11:11:28 EST


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@xxxxxxxxxxxxx>
---
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