From: Felipe Balbi Date: Mon, 16 Nov 2015 22:13:57 +0000 (-0600) Subject: UPSTREAM: usb: dwc3: gadget: simplify next_request() return check X-Git-Tag: firefly_0821_release~3278 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d9863c64a65af2a570212da38873953b8e6cca38;p=firefly-linux-kernel-4.4.55.git UPSTREAM: usb: dwc3: gadget: simplify next_request() return check In dwc3_cleanup_done_reqs() we expect that all iterations of our while (1) loop will find a valid struct dwc3_request *. In case we don't, we're dumping a WARN_ON_ONCE() splat so that people report the failure. This patch is a simple cleanup converting: if (!req) { WARN_ON_ONCE(1); return 1; } to: if (WARN_ON_ONCE(!req)) return 1; which is a little easier to read. Signed-off-by: Felipe Balbi (cherry picked from commit ac7bdcc1b3ad042d21bc65e57503d7b41fc69f05) Change-Id: I1bfea94c01ee9df01930fd743301a7d04ce9b442 Signed-off-by: Wu Liang feng --- diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index ca06ab8e2e4e..3d131b7aae59 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1885,10 +1885,9 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, do { req = next_request(&dep->req_queued); - if (!req) { - WARN_ON_ONCE(1); + if (WARN_ON_ONCE(!req)) return 1; - } + i = 0; do { slot = req->start_slot + i;