From: Maxim Levitsky Date: Fri, 28 Sep 2012 08:38:15 +0000 (+0200) Subject: scatterlist: refactor the sg_nents X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=232f1b51062553b7cf49f99719fbd1b8a8d80f29;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git scatterlist: refactor the sg_nents Replace 'while' with 'for' as suggested by Tejun Heo Signed-off-by: Maxim Levitsky Signed-off-by: Jens Axboe --- 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);