From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8744807291876143289==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: [PATCH] scripts/dtc: fix itnull.cocci warnings Date: Fri, 21 May 2021 02:27:31 +0800 Message-ID: <20210520182731.GA59683@ad678c5af442> In-Reply-To: <202105210256.1Q2XDf1M-lkp@intel.com> List-Id: --===============8744807291876143289== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: kernel test robot 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 Signed-off-by: kernel test robot --- tree: https://android.googlesource.com/kernel/goldfish android-3.18 head: dd54b61f1458c03f68fc019b4874d98f2f0ae3a5 commit: 8214bf079208b146e63cd0a3ce0ed335a87ce7b3 [396/1051] scripts/dtc: Ex= port 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 =3D NULL; c->cache[ca->sb.nr_this_dev] =3D NULL; kobject_put(&ca->kobj); } + } = bch_bset_sort_state_free(&c->sort); free_pages((unsigned long) c->uuids, ilog2(bucket_pages(c))); --===============8744807291876143289==--