usb: gadget: rndis: fix itnull.cocci warnings
authorJulia Lawall <julia.lawall@lip6.fr>
Mon, 25 Jan 2016 15:21:54 +0000 (16:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2016 21:36:04 +0000 (13:36 -0800)
The index variable of list_for_each_entry_safe is an offset from a list
pointer, and thus should not be NULL.

Generated by: scripts/coccinelle/iterators/itnull.cocci

CC: Geliang Tang <geliangtang@163.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/rndis.c

index 34a76db2c8fd688bb4d3ade52128b07ad2efacbd..943c21aafd3b573affe0e61d608b20ec74dc79ee 100644 (file)
@@ -1009,7 +1009,7 @@ void rndis_free_response(struct rndis_params *params, u8 *buf)
        rndis_resp_t *r, *n;
 
        list_for_each_entry_safe(r, n, &params->resp_queue, list) {
-               if (r && r->buf == buf) {
+               if (r->buf == buf) {
                        list_del(&r->list);
                        kfree(r);
                }