scsi: sd: sr: Convert two assignments into warning statements
authorBart Van Assche <bart.vanassche@wdc.com>
Fri, 25 Aug 2017 20:46:33 +0000 (13:46 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 25 Aug 2017 21:08:08 +0000 (17:08 -0400)
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>
drivers/scsi/sd.c
drivers/scsi/sr.c

index bea36adeee178ab57bced3591b0969bc2d973264..a88639fbedb3be77a1a83f39984a8e06548f1a69 100644 (file)
@@ -1013,7 +1013,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
        ret = scsi_init_io(SCpnt);
        if (ret != BLKPREP_OK)
                goto out;
-       SCpnt = rq->special;
+       WARN_ON_ONCE(SCpnt != rq->special);
 
        /* from here on until we're complete, any goto out
         * is used for a killable error condition */
index a8f630213a1a0fce250e23b00a9452676389b159..9be34d37c3567169770563304dd4a927e22b4bc9 100644 (file)
@@ -393,7 +393,7 @@ static int sr_init_command(struct scsi_cmnd *SCpnt)
        ret = scsi_init_io(SCpnt);
        if (ret != BLKPREP_OK)
                goto out;
-       SCpnt = rq->special;
+       WARN_ON_ONCE(SCpnt != rq->special);
        cd = scsi_cd(rq->rq_disk);
 
        /* from here on until we're complete, any goto out