linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete
@ 2019-10-23  0:20 Nathan Chancellor
  2020-02-21  4:57 ` Nathan Chancellor
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Chancellor @ 2019-10-23  0:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Felipe Balbi, Ashwini Pahuja, linux-usb, linux-kernel,
	clang-built-linux, Nathan Chancellor

When building with Clang + -Wtautological-pointer-compare:

drivers/usb/gadget/udc/bdc/bdc_ep.c:543:28: warning: comparison of
address of 'req->queue' equal to a null pointer is always false
[-Wtautological-pointer-compare]
        if (req == NULL  || &req->queue == NULL || &req->usb_req == NULL)
                             ~~~~~^~~~~    ~~~~
drivers/usb/gadget/udc/bdc/bdc_ep.c:543:51: warning: comparison of
address of 'req->usb_req' equal to a null pointer is always false
[-Wtautological-pointer-compare]
        if (req == NULL  || &req->queue == NULL || &req->usb_req == NULL)
                                                    ~~~~~^~~~~~~    ~~~~
2 warnings generated.

As it notes, these statements will always evaluate to false so remove
them.

Fixes: efed421a94e6 ("usb: gadget: Add UDC driver for Broadcom USB3.0 device controller IP BDC")
Link: https://github.com/ClangBuiltLinux/linux/issues/749
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

Note: I am not sure if these checks were intended to check if the
contents of these arrays were NULL or if there should be some other
checks in lieu of these; I am not familiar with the USB subsystem to
answer this but I will happily respin the patch if this is not correct.

 drivers/usb/gadget/udc/bdc/bdc_ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index a4d9b5e1e50e..d49c6dc1082d 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -540,7 +540,7 @@ static void bdc_req_complete(struct bdc_ep *ep, struct bdc_req *req,
 {
 	struct bdc *bdc = ep->bdc;
 
-	if (req == NULL  || &req->queue == NULL || &req->usb_req == NULL)
+	if (req == NULL)
 		return;
 
 	dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status);
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-03-30  7:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23  0:20 [PATCH] usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete Nathan Chancellor
2020-02-21  4:57 ` Nathan Chancellor
2020-02-24 21:42   ` Nick Desaulniers
2020-03-26 19:58     ` Nathan Chancellor
2020-03-28  8:35       ` Felipe Balbi
2020-03-29  1:12         ` [PATCH RESEND] " Nathan Chancellor
2020-03-29  7:43           ` Felipe Balbi
2020-03-29 14:47             ` Nathan Chancellor
2020-03-29 16:43               ` Felipe Balbi
2020-03-30  6:08                 ` Greg Kroah-Hartman
2020-03-30  7:22                   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).