Re: [PATCH 2/3] [SCSI] sd: remove dead code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2011-08-02 at 12:50 +0900, Namhyung Kim wrote:
> As rq_data_dir() only checks a single bit (REQ_WRITE), the result
> can not be anything but READ or WRITE. Thus last ELSE clause is
> not needed at all.

This isn't really dead code, it's future proofing.  Block can handle
bidirectional commands.  It's true that currently the rq_data_dir()
macro is wrong for them.  However, if anyone decided to fix it, we'd
need the check.

James


> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
> ---
>  drivers/scsi/sd.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 463a324835f4..fbb522add124 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -760,12 +760,9 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
>  		    sd_dif_prepare(rq, block, sdp->sector_size) == -EIO)
>  			goto out;
>  
> -	} else if (rq_data_dir(rq) == READ) {
> +	} else { /* READ */
>  		SCpnt->cmnd[0] = READ_6;
>  		SCpnt->sc_data_direction = DMA_FROM_DEVICE;
> -	} else {
> -		scmd_printk(KERN_ERR, SCpnt, "Unknown command %x\n", rq->cmd_flags);
> -		goto out;
>  	}
>  
>  	SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux