summaryrefslogtreecommitdiffstats
path: root/lib/scatterlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scatterlist.c')
-rw-r--r--lib/scatterlist.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 1bf60efb5e02..8cd2ced68f36 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -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);