scatterlist: refactor the sg_nents
Replace 'while' with 'for' as suggested by Tejun Heo
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 1bf60ef..8cd2ced 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -49,12 +49,9 @@
**/
int sg_nents(struct scatterlist *sg)
{
- int nents = 0;
- while (sg) {
+ int nents;
+ for (nents = 0; sg; sg = sg_next(sg))
nents++;
- sg = sg_next(sg);
- }
-
return nents;
}
EXPORT_SYMBOL(sg_nents);