Skip to contentSkip to conversation

scsi: remove superfluous NULL pointer check from scsi_kill_request()

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 3 messages Jul 25, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: remove superfluous NULL pointer check from scsi_kill_request()

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] scsi: remove superfluous NULL pointer check from scsi_kill_request()

Quoted 1 line

From Dan's list:

drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced in initializer 'cmd' drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced before check 'cmd'

We dereference cmd (and possible OOPS if cmd == NULL) before starting the request so just remove the superfluous debugging code altogether.

---
 drivers/scsi/scsi_lib.c |    6 ------
 1 file changed, 6 deletions(-)
drivers/scsi/scsi_lib.c +0 -6
Index: b/drivers/scsi/scsi_lib.c
===================================================================
@@ -1365,12 +1365,6 @@ static void scsi_kill_request(struct req
 
 	blk_start_request(req);
 
-	if (unlikely(cmd == NULL)) {
-		printk(KERN_CRIT "impossible request in %s.\n",
-				 __func__);
-		BUG();
-	}
-
 	scsi_init_cmd_errh(cmd);
 	cmd->result = DID_NO_CONNECT << 16;
 	atomic_inc(&cmd->device->iorequest_cnt);
#1 lore raw
Quoted 41 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] scsi: remove superfluous NULL pointer check from scsi_kill_request()

Quoted 1 line

From Dan's list:

drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced in initializer 'cmd' drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced before check 'cmd'

We dereference cmd (and possible OOPS if cmd == NULL) before starting the request so just remove the superfluous debugging code altogether.

---
 drivers/scsi/scsi_lib.c |    6 ------
 1 file changed, 6 deletions(-)

Index: b/drivers/scsi/scsi_lib.c
===================================================================

drivers/scsi/scsi_lib.c +0 -7
@@ -1365,12 +1365,6 @@ static void scsi_kill_request(struct req
 
 	blk_start_request(req);
 
-	if (unlikely(cmd == NULL)) {
-		printk(KERN_CRIT "impossible request in %s.\n",
-				 __func__);
-		BUG();
-	}
-
 	scsi_init_cmd_errh(cmd);
 	cmd->result = DID_NO_CONNECT << 16;
 	atomic_inc(&cmd->device->iorequest_cnt);
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 2 lines · Joe Perches
Quoted 1 line · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>

Apologies for the empty message. I was attempting to tell Bartomiej his computer time is off but had one too many keys pressed and the message got sent to all before editing.