Skip to contentSkip to conversation

scsi: remove superfluous NULL pointer check from scsi_kill_request()

PATCH RESEND Superseded Bartlomiej Zolnierkiewicz 1 participant 1 message Jan 5, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 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.

[ bart: the potential NULL pointer dereference was finally fixed in
(much later than mine) commit 03b1470 but my patch is still valid ]

---
 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
===================================================================
@@ -1366,12 +1366,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();
-	}
-
 	sdev = cmd->device;
 	starget = scsi_target(sdev);
 	shost = sdev->host;