Skip to content

Commit f2fb134

Browse files
Boris Brezillonrichardweinberger
authored andcommitted
UBI: fastmap: use ubi_rb_for_each_entry() in unmap_peb()
Use the ubi_rb_for_each_entry() macro instead of open-coding it. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent f9efe8d commit f2fb134

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/mtd/ubi/fastmap.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,8 @@ static void unmap_peb(struct ubi_attach_info *ai, int pnum)
385385
struct rb_node *node, *node2;
386386
struct ubi_ainf_peb *aeb;
387387

388-
for (node = rb_first(&ai->volumes); node; node = rb_next(node)) {
389-
av = rb_entry(node, struct ubi_ainf_volume, rb);
390-
391-
for (node2 = rb_first(&av->root); node2;
392-
node2 = rb_next(node2)) {
393-
aeb = rb_entry(node2, struct ubi_ainf_peb, u.rb);
388+
ubi_rb_for_each_entry(node, av, &ai->volumes, rb) {
389+
ubi_rb_for_each_entry(node2, aeb, &av->root, u.rb) {
394390
if (aeb->pnum == pnum) {
395391
rb_erase(&aeb->u.rb, &av->root);
396392
av->leb_count--;

0 commit comments

Comments
 (0)