From: Keith Busch Date: Fri, 23 Feb 2024 15:59:07 +0000 (-0800) Subject: block: blkdev_issue_secure_erase loop style X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5affe497c346343ecc42e6095b60dafe15e1453e;p=users%2Fjedix%2Flinux-maple.git 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 Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Reviewed-by: Chaitanya Kulkarni Link: https://lore.kernel.org/r/20240223155910.3622666-2-kbusch@meta.com Signed-off-by: Jens Axboe --- 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;