Re: [PATCH 2/3] [SCSI] sd: remove dead code
From: James Bottomley
Date: Tue Aug 02 2011 - 12:29:54 EST
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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/