Message ID | 20171109002643.6712-1-xypron.glpk@gmx.de |
---|---|
State | Accepted |
Commit | 76df275ce53c0435ff4df2e8f1015522d39efd38 |
Delegated to: | Tom Rini |
Headers | show |
Series | [U-Boot,v2,1/1] yaffs2: rework yaffs_new_obj_id | expand |
On Thu, Nov 09, 2017 at 01:26:43AM +0100, Heinrich Schuchardt wrote: > 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> Applied to u-boot/master, thanks!
diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c index 32e6ff2a04..bbe0d700fb 100644 --- a/fs/yaffs2/yaffs_guts.c +++ b/fs/yaffs2/yaffs_guts.c @@ -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; } } }
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> --- v2 Avoid changing logic. --- fs/yaffs2/yaffs_guts.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)