]> www.infradead.org Git - users/hch/block.git/commitdiff
mtd_blkdevs: remove the sector out of range check in do_blktrans_request
authorChristoph Hellwig <hch@lst.de>
Fri, 3 Sep 2021 06:16:05 +0000 (08:16 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 26 Nov 2021 12:16:28 +0000 (13:16 +0100)
The block layer already performs this check, no need to duplicate it in
the driver.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/mtd_blkdevs.c

index 66f81d42fe778e62fea71c81e4aad5c0f14b818c..113f86df7603857562ebf969ad2bcfdeae007f48 100644 (file)
@@ -54,17 +54,11 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr,
        block = blk_rq_pos(req) << 9 >> tr->blkshift;
        nsect = blk_rq_cur_bytes(req) >> tr->blkshift;
 
-       if (req_op(req) == REQ_OP_FLUSH) {
+       switch (req_op(req)) {
+       case REQ_OP_FLUSH:
                if (tr->flush(dev))
                        return BLK_STS_IOERR;
                return BLK_STS_OK;
-       }
-
-       if (blk_rq_pos(req) + blk_rq_cur_sectors(req) >
-           get_capacity(req->rq_disk))
-               return BLK_STS_IOERR;
-
-       switch (req_op(req)) {
        case REQ_OP_DISCARD:
                if (tr->discard(dev, block, nsect))
                        return BLK_STS_IOERR;