diff options
| author | Chaitanya Kulkarni <ckulkarnilinux@gmail.com> | 2025-11-24 15:48:01 -0800 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-11-25 12:19:39 -0700 |
| commit | 7d09a8e25121a20214558d013b31e17ff84b004d (patch) | |
| tree | 95f0a9f020c96ba7506f5d5dc846b27dd394c081 | |
| parent | 3a64c46c40460386aeca6e8698076d1207aeaf44 (diff) | |
block: ignore __blkdev_issue_discard() return value
__blkdev_issue_discard() always returns 0, making the error check
in blkdev_issue_discard() dead code.
In function blkdev_issue_discard() initialize ret = 0, remove ret
assignment from __blkdev_issue_discard(), rely on bio == NULL check to
call submit_bio_wait(), preserve submit_bio_wait() error handling, and
preserve -EOPNOTSUPP to 0 mapping.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | block/blk-lib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c index 3030a772d3aa..19e0203cc18a 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -87,11 +87,11 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, { struct bio *bio = NULL; struct blk_plug plug; - int ret; + int ret = 0; blk_start_plug(&plug); - ret = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, &bio); - if (!ret && bio) { + __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, &bio); + if (bio) { ret = submit_bio_wait(bio); if (ret == -EOPNOTSUPP) ret = 0; |
