UBI: fix the volumes tree sorting criteria
authorHeiko Schocher <hs@denx.de>
Tue, 24 Jun 2014 07:25:18 +0000 (09:25 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 1 Jul 2014 06:23:03 +0000 (09:23 +0300)
Commig "604b592 UBI: fix rb_tree node comparison in add_map"
broke fastmap backward compatibility and older fastmap images
cannot be mounted anymore. The reason is that it changes the
volumes RB-tree sorting criteria. This patch fixes the problem.

Artem: re-write the commit message

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/ubi/fastmap.c

index b04e7d059888d3fd36c82cdba3b9863cb25901e1..72f39daee649e9bccd0597d96cb001515f89ec63 100644 (file)
@@ -125,7 +125,7 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id,
                parent = *p;
                av = rb_entry(parent, struct ubi_ainf_volume, rb);
 
-               if (vol_id < av->vol_id)
+               if (vol_id > av->vol_id)
                        p = &(*p)->rb_left;
                else
                        p = &(*p)->rb_right;