[U-Boot] [PATCH 1/1] yaffs2: rework yaffs_new_obj_id
Heinrich Schuchardt
xypron.glpk at gmx.de
Wed Nov 8 22:30:00 UTC 2017
The iterator variable of list_for_each is never NULL.
if (1 || A) is always true.
Remove superfluous while.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
fs/yaffs2/yaffs_guts.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index 32e6ff2a04..509e9839f1 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -1859,26 +1859,17 @@ static int yaffs_find_nice_bucket(struct yaffs_dev *dev)
static int yaffs_new_obj_id(struct yaffs_dev *dev)
{
int bucket = yaffs_find_nice_bucket(dev);
- int found = 0;
struct list_head *i;
u32 n = (u32) bucket;
/* Now find an object value that has not already been taken
* by scanning the list.
*/
-
- while (!found) {
- found = 1;
+ n += YAFFS_NOBJECT_BUCKETS;
+ list_for_each(i, &dev->obj_bucket[bucket].list) {
+ if (list_entry(i, struct yaffs_obj, hash_link)->obj_id != n)
+ break;
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;
- }
- }
- }
}
return n;
}
--
2.14.2
More information about the U-Boot
mailing list