usb: gadget: rndis: fix itnull.cocci warnings

Author: Julia Lawall <julia.lawall@lip6.fr>

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 
Signed-off-by: Fengguang Wu 
Signed-off-by: Julia Lawall 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/gadget/function/rndis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 34a76db..943c21a 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -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);
 		}
BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.