Hi Amit, There are new coccinelle warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm head: 6a015080d00181e3a650d51e078ea14be82abfc4 commit: 24c8a66b8a75ed71806695fc232fb9499a7f672d [16/51] thermal: add generic cpufreq cooling implementation All coccinelle warnings: + drivers/thermal/cpu_cooling.c:461:6-17: ERROR: iterator variable bound on line 460 cannot be NULL drivers/thermal/cpu_cooling.c:323:6-20: ERROR: iterator variable bound on line 322 cannot be NULL drivers/thermal/cpu_cooling.c:300:6-20: ERROR: iterator variable bound on line 299 cannot be NULL drivers/thermal/cpu_cooling.c:346:6-20: ERROR: iterator variable bound on line 345 cannot be NULL vim +461 drivers/thermal/cpu_cooling.c 458 459 mutex_lock(&cooling_cpufreq_lock); 460 list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node) { > 461 if (cpufreq_dev && cpufreq_dev->cool_dev == cdev) 462 break; 463 cpufreq_dev_count++; 464 } Please fold the attached patch if you agree with the warnings. --- 0-DAY kernel build testing backend Open Source Technology Centre Fengguang Wu <wfg@xxxxxxxxxxxxxxx> Intel Corporation
Generated by: iterators/itnull.cocci 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). --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -297,7 +297,7 @@ static int cpufreq_get_max_state(struct mutex_lock(&cooling_cpufreq_lock); list_for_each_entry(cpufreq_device, &cooling_cpufreq_list, node) { - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { + if (cpufreq_device->cool_dev == cdev) { *state = cpufreq_device->tab_size; ret = 0; break; @@ -320,7 +320,7 @@ static int cpufreq_get_cur_state(struct mutex_lock(&cooling_cpufreq_lock); list_for_each_entry(cpufreq_device, &cooling_cpufreq_list, node) { - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { + if (cpufreq_device->cool_dev == cdev) { *state = cpufreq_device->cpufreq_state; ret = 0; break; @@ -343,7 +343,7 @@ static int cpufreq_set_cur_state(struct mutex_lock(&cooling_cpufreq_lock); list_for_each_entry(cpufreq_device, &cooling_cpufreq_list, node) { - if (cpufreq_device && cpufreq_device->cool_dev == cdev) { + if (cpufreq_device->cool_dev == cdev) { ret = 0; break; } @@ -458,7 +458,7 @@ void cpufreq_cooling_unregister(struct t mutex_lock(&cooling_cpufreq_lock); list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node) { - if (cpufreq_dev && cpufreq_dev->cool_dev == cdev) + if (cpufreq_dev->cool_dev == cdev) break; cpufreq_dev_count++; }