From 70a49638a01daa7dc11d7e7c619fa70851108624 Mon Sep 17 00:00:00 2001 From: Alone Dangal Date: Fri, 27 Feb 2026 20:51:41 +0545 Subject: [PATCH] block: cleanup various NULL pointer comparisons Remove open-coded NULL comparisons to follow kernel coding style guidelines. While at it, remove a trailing whitespace in blk-core.c. Signed-off-by: Alone Dangal --- block/badblocks.c | 2 +- block/bio.c | 2 +- block/blk-core.c | 4 ++-- block/blk-iolatency.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/badblocks.c b/block/badblocks.c index ece64e76fe8ff..d409e6b6e49ae 100644 --- a/block/badblocks.c +++ b/block/badblocks.c @@ -1374,7 +1374,7 @@ EXPORT_SYMBOL_GPL(badblocks_clear); */ void ack_all_badblocks(struct badblocks *bb) { - if (bb->page == NULL || bb->changed) + if (!bb->page || bb->changed) /* no point even trying */ return; write_seqlock_irq(&bb->lock); diff --git a/block/bio.c b/block/bio.c index d80d5d26804e3..e15f30a5c4328 100644 --- a/block/bio.c +++ b/block/bio.c @@ -762,7 +762,7 @@ static int __bio_alloc_cache_prune(struct bio_alloc_cache *cache, unsigned int i = 0; struct bio *bio; - while ((bio = cache->free_list) != NULL) { + while ((bio = cache->free_list)) { cache->free_list = bio->bi_next; cache->nr--; bio_free(bio); diff --git a/block/blk-core.c b/block/blk-core.c index 474700ffaa1c8..ae075a95bfec1 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -635,7 +635,7 @@ static void __submit_bio(struct bio *bio) blk_mq_submit_bio(bio); } else if (likely(bio_queue_enter(bio) == 0)) { struct gendisk *disk = bio->bi_bdev->bd_disk; - + if ((bio->bi_opf & REQ_POLLED) && !(disk->queue->limits.features & BLK_FEAT_POLL)) { bio->bi_status = BLK_STS_NOTSUPP; @@ -695,7 +695,7 @@ static void __submit_bio_noacct(struct bio *bio) */ bio_list_init(&lower); bio_list_init(&same); - while ((bio = bio_list_pop(&bio_list_on_stack[0])) != NULL) + while ((bio = bio_list_pop(&bio_list_on_stack[0]))) if (q == bdev_get_queue(bio->bi_bdev)) bio_list_add(&same, bio); else diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index 53e8dd2dfa8ad..dbd951e8c1160 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -689,7 +689,7 @@ static void blkiolatency_timer_fn(struct timer_list *t) * We scaled down but don't have a scale_grp, scale up and carry * on. */ - if (lat_info->scale_grp == NULL) { + if (!lat_info->scale_grp) { scale_cookie_change(iolat->blkiolat, lat_info, true); goto next_lock; }