summaryrefslogtreecommitdiffstats
path: root/block/blk-crypto-fallback.c
diff options
context:
space:
mode:
authorJohn Garry <john.g.garry@oracle.com>2024-11-11 12:21:45 +0100
committerJens Axboe <axboe@kernel.dk>2024-11-11 16:35:46 +0100
commite546fe1da9bd47a6fddce6b37c17b1aa1811f7d3 (patch)
tree6f9f63b0c46fe67d02d31fff3acd8a85d6f31d03 /block/blk-crypto-fallback.c
parentublk: fix ublk_ch_mmap() for 64K page size (diff)
downloadlinux-e546fe1da9bd47a6fddce6b37c17b1aa1811f7d3.tar.xz
linux-e546fe1da9bd47a6fddce6b37c17b1aa1811f7d3.zip
block: Rework bio_split() return value
Instead of returning an inconclusive value of NULL for an error in calling bio_split(), return a ERR_PTR() always. Also remove the BUG_ON() calls, and WARN_ON_ONCE() instead. Indeed, since almost all callers don't check the return code from bio_split(), we'll crash anyway (for those failures). Fix up the only user which checks bio_split() return code today (directly or indirectly), blk_crypto_fallback_split_bio_if_needed(). The md/bcache code does check the return code in cached_dev_cache_miss() -> bio_next_split() -> bio_split(), but only to see if there was a split, so there would be no change in behaviour here (when returning a ERR_PTR()). Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20241111112150.3756529-2-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-crypto-fallback.c')
-rw-r--r--block/blk-crypto-fallback.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c
index b1e7415f8439..29a205482617 100644
--- a/block/blk-crypto-fallback.c
+++ b/block/blk-crypto-fallback.c
@@ -226,7 +226,7 @@ static bool blk_crypto_fallback_split_bio_if_needed(struct bio **bio_ptr)
split_bio = bio_split(bio, num_sectors, GFP_NOIO,
&crypto_bio_split);
- if (!split_bio) {
+ if (IS_ERR(split_bio)) {
bio->bi_status = BLK_STS_RESOURCE;
return false;
}