aboutsummaryrefslogtreecommitdiff
path: root/block/blk-lib.c
diff options
context:
space:
mode:
authorKeith Busch2024-02-23 07:59:07 -0800
committerJens Axboe2024-02-24 12:46:46 -0700
commit5affe497c346343ecc42e6095b60dafe15e1453e (patch)
tree50acb4d188343d21a1c4050d3590f7ba9c777c24 /block/blk-lib.c
parent03f12122b20b6e6028e9ed69030a49f9cffcbb75 (diff)
block: blkdev_issue_secure_erase loop style
Use consistent coding style in this file. All the other loops for the same purpose use "while (nr_sects)", so they win. Reviewed-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20240223155910.3622666-2-kbusch@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-lib.c')
-rw-r--r--block/blk-lib.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c
index e59c3069e835..91770da2239f 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -322,7 +322,7 @@ int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector,
return -EPERM;
blk_start_plug(&plug);
- for (;;) {
+ while (nr_sects) {
unsigned int len = min_t(sector_t, nr_sects, max_sectors);
bio = blk_next_bio(bio, bdev, 0, REQ_OP_SECURE_ERASE, gfp);
@@ -331,13 +331,12 @@ int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector,
sector += len;
nr_sects -= len;
- if (!nr_sects) {
- ret = submit_bio_wait(bio);
- bio_put(bio);
- break;
- }
cond_resched();
}
+ if (bio) {
+ ret = submit_bio_wait(bio);
+ bio_put(bio);
+ }
blk_finish_plug(&plug);
return ret;