TO: Fei Yang <[email protected]>
CC: [email protected]
CC: Stefan Stanacar <[email protected]>

drivers/extcon/extcon-class.c:438:14-16: ERROR: iterator variable bound on line 
437 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

CC: Fei Yang <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
---

Please take the patch only if it's a positive warning. Thanks!

 extcon-class.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -435,7 +435,7 @@ int extcon_num_of_cable_devs(const char
 
        mutex_lock(&extcon_dev_list_lock);
        list_for_each_entry(sd, &extcon_dev_list, entry) {
-               for (i = 0; sd && i < sd->max_supported; i++) {
+               for (i = 0; i < sd->max_supported; i++) {
                        if (!strcmp(sd->supported_cable[i], cable))
                                j++;
                }
_______________________________________________
kbuild mailing list
[email protected]
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to