From: kernel test robot <lkp(a)intel.com>
drivers/md/bcache/super.c:1392:6-8: ERROR: iterator variable bound on line 1391 cannot be
NULL
Many iterators have the property that the first argument is always bound
to a real list element, never NULL.
Semantic patch information:
False positives arise for some iterators that do not have this property,
or in cases when the loop cursor is reassigned. The latter should only
happen when the matched code is on the way to a loop exit (break, goto,
or return).
Generated by: scripts/coccinelle/iterators/itnull.cocci
Fixes: 8214bf079208 ("scripts/dtc: Export YYLOC global declaration")
Reported-by: kernel test robot <lkp(a)intel.com>
Signed-off-by: kernel test robot <lkp(a)intel.com>
---
tree:
https://android.googlesource.com/kernel/goldfish android-3.18
head: dd54b61f1458c03f68fc019b4874d98f2f0ae3a5
commit: 8214bf079208b146e63cd0a3ce0ed335a87ce7b3 [396/1051] scripts/dtc: Export YYLOC
global declaration
:::::: branch date: 5 weeks ago
:::::: commit date: 3 months ago
Please take the patch only if it's a positive warning. Thanks!
super.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1389,11 +1389,12 @@ static void cache_set_free(struct closur
mutex_lock(&bch_register_lock);
for_each_cache(ca, c, i)
- if (ca) {
+ { {
ca->set = NULL;
c->cache[ca->sb.nr_this_dev] = NULL;
kobject_put(&ca->kobj);
}
+ }
bch_bset_sort_state_free(&c->sort);
free_pages((unsigned long) c->uuids, ilog2(bucket_pages(c)));