Skip to content

Commit

Permalink
scatterlist: refactor the sg_nents
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Maxim Levitsky authored and Jens Axboe committed Sep 28, 2012
1 parent 2e48461 commit 232f1b5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/scatterlist.c
Original file line number Diff line number Diff line change
@@ -49,12 +49,9 @@ EXPORT_SYMBOL(sg_next);
**/
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);

0 comments on commit 232f1b5

Please sign in to comment.