UBI: fix rb_tree node comparison in add_map
authorMike Snitzer <snitzer@redhat.com>
Fri, 21 Mar 2014 19:54:03 +0000 (15:54 -0400)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 13 May 2014 10:47:23 +0000 (13:47 +0300)
The comparisons used in add_vol() shouldn't be identical.  Pretty sure
the following is correct but it is completely untested.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/mtd/ubi/fastmap.c

index c5dad652614d747df33477dbd414c472572aefe5..b04e7d059888d3fd36c82cdba3b9863cb25901e1 100644 (file)
@@ -125,9 +125,9 @@ 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 if (vol_id > av->vol_id)
+               else
                        p = &(*p)->rb_right;
        }