All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Liu <b-liu@ti.com>
To: Sekhar Nori <nsekhar@ti.com>
Cc: linux-usb@vger.kernel.org
Subject: [1/3] usb: musb: gadget: fix to_musb_request() to not return NULL
Date: Thu, 26 Apr 2018 07:48:26 -0500	[thread overview]
Message-ID: <20180426124826.GA21238@uda0271908> (raw)

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

             reply	other threads:[~2018-04-26 12:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 12:48 Bin Liu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-04-26  5:55 [1/3] usb: musb: gadget: fix to_musb_request() to not return NULL Sekhar Nori
2018-04-26  5:53 Sekhar Nori
2018-04-18 20:05 Bin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180426124826.GA21238@uda0271908 \
    --to=b-liu@ti.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.