[PATCH v2] scsi: target: Remove unnecessary null checking for bio allocation

From: Kohei Enju
Date: Sun Feb 02 2025 - 10:28:24 EST


Remove unnecessary null checking because bio_alloc_bioset() is
guaranteed to succeed with __GFP_DIRECT_RECLAIM (included in GFP_NOIO).
For more details, please see the comment in bio_alloc_bioset().

Signed-off-by: Kohei Enju <enjuk@xxxxxxxxxx>
---
v1: https://lore.kernel.org/target-devel/20250202090208.26890-1-enjuk@xxxxxxxxxx/T/#u
v1->v2:
* Fix the commit message to use imperative mood
* Remove the unnecessary blank line
---
drivers/target/target_core_iblock.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index c8dc92a7d63e..a53e41212cdd 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -369,11 +369,6 @@ static struct bio *iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num,
*/
bio = bio_alloc_bioset(ib_dev->ibd_bd, bio_max_segs(sg_num), opf,
GFP_NOIO, &ib_dev->ibd_bio_set);
- if (!bio) {
- pr_err("Unable to allocate memory for bio\n");
- return NULL;
- }
-
bio->bi_private = cmd;
bio->bi_end_io = &iblock_bio_done;
bio->bi_iter.bi_sector = lba;
--
2.39.5 (Apple Git-154)