Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: remove unnecessary goto labels in debugfs attribute read methods

In some debugfs attribute read methods, failure to acquire the mutex
lock results in jumping to a label before returning an error code.
However this is unnecessary, as we can return the failure code directly,
improving code readability and reducing complexity.

This commit removes the goto labels and ensures that the method returns
immediately upon failing to acquire the mutex lock.

Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250313115235.3707600-3-nilay@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Nilay Shroff and committed by
Jens Axboe
78800f59 a3996d11

+8 -12
+8 -12
block/blk-mq-debugfs.c
··· 402 402 403 403 res = mutex_lock_interruptible(&q->elevator_lock); 404 404 if (res) 405 - goto out; 405 + return res; 406 406 if (hctx->tags) 407 407 blk_mq_debugfs_tags_show(m, hctx->tags); 408 408 mutex_unlock(&q->elevator_lock); 409 409 410 - out: 411 - return res; 410 + return 0; 412 411 } 413 412 414 413 static int hctx_tags_bitmap_show(void *data, struct seq_file *m) ··· 418 419 419 420 res = mutex_lock_interruptible(&q->elevator_lock); 420 421 if (res) 421 - goto out; 422 + return res; 422 423 if (hctx->tags) 423 424 sbitmap_bitmap_show(&hctx->tags->bitmap_tags.sb, m); 424 425 mutex_unlock(&q->elevator_lock); 425 426 426 - out: 427 - return res; 427 + return 0; 428 428 } 429 429 430 430 static int hctx_sched_tags_show(void *data, struct seq_file *m) ··· 434 436 435 437 res = mutex_lock_interruptible(&q->elevator_lock); 436 438 if (res) 437 - goto out; 439 + return res; 438 440 if (hctx->sched_tags) 439 441 blk_mq_debugfs_tags_show(m, hctx->sched_tags); 440 442 mutex_unlock(&q->elevator_lock); 441 443 442 - out: 443 - return res; 444 + return 0; 444 445 } 445 446 446 447 static int hctx_sched_tags_bitmap_show(void *data, struct seq_file *m) ··· 450 453 451 454 res = mutex_lock_interruptible(&q->elevator_lock); 452 455 if (res) 453 - goto out; 456 + return res; 454 457 if (hctx->sched_tags) 455 458 sbitmap_bitmap_show(&hctx->sched_tags->bitmap_tags.sb, m); 456 459 mutex_unlock(&q->elevator_lock); 457 460 458 - out: 459 - return res; 461 + return 0; 460 462 } 461 463 462 464 static int hctx_active_show(void *data, struct seq_file *m)