Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: sd: sr: Convert two assignments into warning statements

Before scsi_prep_fn() calls the ULP .init_command() callback
function it stores the SCSI command pointer in request.special.
This means that the SCpnt = rq->special assignments in the sd
and sr drivers assign a pointer to itself. Hence convert these
two assignment statements into warning statements.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
0624cbb1 bed2213d

+2 -2
+1 -1
drivers/scsi/sd.c
··· 1013 1013 ret = scsi_init_io(SCpnt); 1014 1014 if (ret != BLKPREP_OK) 1015 1015 goto out; 1016 - SCpnt = rq->special; 1016 + WARN_ON_ONCE(SCpnt != rq->special); 1017 1017 1018 1018 /* from here on until we're complete, any goto out 1019 1019 * is used for a killable error condition */
+1 -1
drivers/scsi/sr.c
··· 393 393 ret = scsi_init_io(SCpnt); 394 394 if (ret != BLKPREP_OK) 395 395 goto out; 396 - SCpnt = rq->special; 396 + WARN_ON_ONCE(SCpnt != rq->special); 397 397 cd = scsi_cd(rq->rq_disk); 398 398 399 399 /* from here on until we're complete, any goto out