]> git.sur5r.net Git - u-boot/commitdiff
yaffs2: rework yaffs_new_obj_id
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 9 Nov 2017 00:26:43 +0000 (01:26 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 21 Nov 2017 01:18:38 +0000 (20:18 -0500)
The iterator variable of list_for_each is never NULL.
if (1 || A) is always true.
Use break if entry found.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
fs/yaffs2/yaffs_guts.c

index 32e6ff2a040660ad22e43f19fc38920fdede1a02..bbe0d700fb63e8d7754d37163dbbaef45745daa3 100644 (file)
@@ -1870,13 +1870,12 @@ static int yaffs_new_obj_id(struct yaffs_dev *dev)
        while (!found) {
                found = 1;
                n += YAFFS_NOBJECT_BUCKETS;
-               if (1 || dev->obj_bucket[bucket].count > 0) {
-                       list_for_each(i, &dev->obj_bucket[bucket].list) {
-                               /* If there is already one in the list */
-                               if (i && list_entry(i, struct yaffs_obj,
-                                                   hash_link)->obj_id == n) {
-                                       found = 0;
-                               }
+               list_for_each(i, &dev->obj_bucket[bucket].list) {
+                       /* If there is already one in the list */
+                       if (i && list_entry(i, struct yaffs_obj,
+                                           hash_link)->obj_id == n) {
+                               found = 0;
+                               break;
                        }
                }
        }