diff mbox series

cxlflash: remove an unnecessary NULL check

Message ID 20200605110258.GD978434@mwanda (mailing list archive)
State Mainlined
Commit 89dd9ce784fb64e732676b7958a0278750304567
Headers show
Series cxlflash: remove an unnecessary NULL check | expand

Commit Message

Dan Carpenter June 5, 2020, 11:02 a.m. UTC
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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/cxlflash/main.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Martin K. Petersen June 10, 2020, 2:02 a.m. UTC | #1
On Fri, 5 Jun 2020 14:02:58 +0300, Dan Carpenter wrote:

> 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
diff mbox series

Patch

diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index fcc5aa9f60147..94250ebe9e803 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -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) {