* [1/3] usb: musb: gadget: fix to_musb_request() to not return NULL
@ 2018-04-18 20:05 Bin Liu
0 siblings, 0 replies; 4+ messages in thread
From: Bin Liu @ 2018-04-18 20:05 UTC (permalink / raw)
To: linux-usb
The gadget function drivers should ensure the usb_request parameter
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 <b-liu@ti.com>
---
drivers/usb/musb/musb_gadget.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h
index 9c34aca06db6..466877b471ef 100644
--- a/drivers/usb/musb/musb_gadget.h
+++ b/drivers/usb/musb/musb_gadget.h
@@ -60,10 +60,7 @@ struct musb_request {
enum buffer_map_state map_state;
};
-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))
extern struct usb_request *
musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [1/3] usb: musb: gadget: fix to_musb_request() to not return NULL
@ 2018-04-26 12:48 Bin Liu
0 siblings, 0 replies; 4+ messages in thread
From: Bin Liu @ 2018-04-26 12:48 UTC (permalink / raw)
To: Sekhar Nori; +Cc: linux-usb
On Thu, Apr 26, 2018 at 11:25:16AM +0530, Sekhar Nori wrote:
> On Thursday 26 April 2018 11:23 AM, Sekhar Nori wrote:
> > On Thursday 19 April 2018 01:35 AM, Bin Liu wrote:
> >> The gadget function drivers should ensure the usb_request parameter
> >> 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 <b-liu@ti.com>
> >> ---
> >> drivers/usb/musb/musb_gadget.h | 5 +----
> >> 1 file changed, 1 insertion(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h
> >> index 9c34aca06db6..466877b471ef 100644
> >> --- a/drivers/usb/musb/musb_gadget.h
> >> +++ b/drivers/usb/musb/musb_gadget.h
> >> @@ -60,10 +60,7 @@ struct musb_request {
> >> enum buffer_map_state map_state;
> >> };
> >>
> >> -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
>
> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [1/3] usb: musb: gadget: fix to_musb_request() to not return NULL
@ 2018-04-26 5:55 Sekhar Nori
0 siblings, 0 replies; 4+ messages in thread
From: Sekhar Nori @ 2018-04-26 5:55 UTC (permalink / raw)
To: Bin Liu, linux-usb
On Thursday 26 April 2018 11:23 AM, Sekhar Nori wrote:
> On Thursday 19 April 2018 01:35 AM, Bin Liu wrote:
>> The gadget function drivers should ensure the usb_request parameter
>> 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 <b-liu@ti.com>
>> ---
>> drivers/usb/musb/musb_gadget.h | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h
>> index 9c34aca06db6..466877b471ef 100644
>> --- a/drivers/usb/musb/musb_gadget.h
>> +++ b/drivers/usb/musb/musb_gadget.h
>> @@ -60,10 +60,7 @@ struct musb_request {
>> enum buffer_map_state map_state;
>> };
>>
>> -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
And 'r' can actually be parenthesized for safety.
Thanks,
Sekhar
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [1/3] usb: musb: gadget: fix to_musb_request() to not return NULL
@ 2018-04-26 5:53 Sekhar Nori
0 siblings, 0 replies; 4+ messages in thread
From: Sekhar Nori @ 2018-04-26 5:53 UTC (permalink / raw)
To: Bin Liu, linux-usb
On Thursday 19 April 2018 01:35 AM, Bin Liu wrote:
> The gadget function drivers should ensure the usb_request parameter
> 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 <b-liu@ti.com>
> ---
> drivers/usb/musb/musb_gadget.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h
> index 9c34aca06db6..466877b471ef 100644
> --- a/drivers/usb/musb/musb_gadget.h
> +++ b/drivers/usb/musb/musb_gadget.h
> @@ -60,10 +60,7 @@ struct musb_request {
> enum buffer_map_state map_state;
> };
>
> -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
Thanks,
Sekhar
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-26 12:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 20:05 [1/3] usb: musb: gadget: fix to_musb_request() to not return NULL Bin Liu
2018-04-26 5:53 Sekhar Nori
2018-04-26 5:55 Sekhar Nori
2018-04-26 12:48 Bin Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.