diff options
| author | Sughosh Ganu <[email protected]> | 2024-08-28 22:24:22 +0530 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-08-30 13:51:38 -0600 |
| commit | be222ac029c31b38ffdfdc135ced8b5a40b8216b (patch) | |
| tree | 3546c8860d46694952674e88766c6e0eccbe71ad /drivers | |
| parent | e83ced1a24095de66e526bd6c10f0f24584baaee (diff) | |
list: use list_count_nodes() to count list entries
Use the API function list_count_nodes() to count the number of list
entries.
Signed-off-by: Sughosh Ganu <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/mtd/ubi/fastmap.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 21750e1817b..9c6b15b8cb5 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -581,13 +581,11 @@ static int count_fastmap_pebs(struct ubi_attach_info *ai) struct ubi_ainf_peb *aeb; struct ubi_ainf_volume *av; struct rb_node *rb1, *rb2; - int n = 0; + int n; - list_for_each_entry(aeb, &ai->erase, u.list) - n++; + n = list_count_nodes(&ai->erase); - list_for_each_entry(aeb, &ai->free, u.list) - n++; + n += list_count_nodes(&ai->free); ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) |
