Skip to contentSkip to conversation

cxlflash: remove an unnecessary NULL check

PATCH Applied Dan Carpenter 2 participants 2 messages Jun 5, 2020 – Jun 10, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxlflash: remove an unnecessary NULL check

The "cmd" pointer was already dereferenced a couple lines earlier so this NULL check is too late. Fortunately, the pointer can never be NULL and the check can be removed.

---
 drivers/scsi/cxlflash/main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/scsi/cxlflash/main.c +0 -3
index fcc5aa9f60147..94250ebe9e803 100644
@@ -47,9 +47,6 @@ static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp)
 	struct sisl_ioasa *ioasa;
 	u32 resid;
 
-	if (unlikely(!cmd))
-		return;
-
 	ioasa = &(cmd->sa);
 
 	if (ioasa->rc.flags & SISL_RC_FLAGS_UNDERRUN) {
Signature · 1 line
2.26.2
#1 lore raw
Quoted 3 lines · Dan Carpenter

The "cmd" pointer was already dereferenced a couple lines earlier so this NULL check is too late. Fortunately, the pointer can never be NULL and the check can be removed.

Applied to 5.8/scsi-queue, thanks!

[1/1] scsi: cxlflash: Remove an unnecessary NULL check

      https://git.kernel.org/mkp/scsi/c/89dd9ce784fb
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering