yaffs2: iterator variable cannot be NULL
The iterator of list_for_each() is never NULL.
Identified with coccinelle.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index bbe0d70..c8b27ad 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -1872,8 +1872,8 @@
n += YAFFS_NOBJECT_BUCKETS;
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) {
+ if (list_entry(i, struct yaffs_obj,
+ hash_link)->obj_id == n) {
found = 0;
break;
}
diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c
index ba76a5c..47abc6b 100644
--- a/fs/yaffs2/yaffsfs.c
+++ b/fs/yaffs2/yaffsfs.c
@@ -2847,12 +2847,9 @@
* the next one to prevent a hanging ptr.
*/
list_for_each(i, &search_contexts) {
- if (i) {
- dsc = list_entry(i, struct yaffsfs_DirSearchContxt,
- others);
- if (dsc->nextReturn == obj)
- yaffsfs_DirAdvance(dsc);
- }
+ dsc = list_entry(i, struct yaffsfs_DirSearchContxt, others);
+ if (dsc->nextReturn == obj)
+ yaffsfs_DirAdvance(dsc);
}
}