usb: musb: gadget: fix to_musb_request() to not return NULL
PATCH 1/3 usb: musb: gadget: fix to_musb_request() to not return NULL
Quoted 30 lines · Sekhar Nori
Quoted 21 lines · Sekhar Nori
Quoted 20 lines · Bin Liu
The gadget function drivers should ensure the
usb_requestparameter passed in is not NULL. UDC core doesn't check if it is NULL, so MUSB driver shouldn't have to check it either.Convert
to_musb_request()to a simple macro to not directly return NULL to avoid warnings from code static analysis tools.Signed-off-by Bin Liu <[email protected]>--- drivers/usb/musb/musb_gadget.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/usb/musb/musb_gadget.h +0
-0@@ -60,10 +60,7 @@ struct musb_request {enum buffer_map_state map_state; };Quoted 7 lines
drivers/usb/musb/musb_gadget.h struct musb_request { · line 63
Quoted 5 lines
drivers/usb/musb/musb_gadget.h +1
-4-static inline struct musb_request *to_musb_request (struct usb_request *req) -{ - return req ? container_of(req, struct musb_request, request) : NULL; -} +#define to_musb_request (r) (container_of(r, struct musb_request, request))Unnecessary parens over
container_of
Quoted 1 line
And 'r' can actually be parenthesized for safety.
Thanks. v2 is sent.
Regards,
-Bin.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html