public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Alone Dangal <yogeshdangal66@gmail.com>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alone Dangal <yogeshdangal66@gmail.com>
Subject: [PATCH] block: cleanup various NULL pointer comparisons
Date: Fri, 27 Feb 2026 20:51:41 +0545	[thread overview]
Message-ID: <20260227150641.28735-1-yogeshdangal66@gmail.com> (raw)

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 <yogeshdangal66@gmail.com>
---
 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 ece64e76f..d409e6b6e 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 d80d5d268..e15f30a5c 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 474700ffa..ae075a95b 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 53e8dd2df..dbd951e8c 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;
 		}
-- 
2.53.0


             reply	other threads:[~2026-02-27 15:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27 15:06 Alone Dangal [this message]
2026-03-18 14:30 ` [PATCH] block: cleanup various NULL pointer comparisons Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260227150641.28735-1-yogeshdangal66@gmail.com \
    --to=yogeshdangal66@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox