Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933767AbcKGTRD (ORCPT ); Mon, 7 Nov 2016 14:17:03 -0500 Received: from smtprelay2.synopsys.com ([198.182.60.111]:44148 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933242AbcKGTQ6 (ORCPT ); Mon, 7 Nov 2016 14:16:58 -0500 Subject: Re: [PATCH] usb: dwc2: gadget: simplify list handling To: Nicholas Mc Guire , John Youn References: <1478545683-29897-1-git-send-email-hofrat@osadl.org> CC: Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Felipe Balbi From: John Youn Message-ID: Date: Mon, 7 Nov 2016 11:16:37 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1478545683-29897-1-git-send-email-hofrat@osadl.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.9.139.95] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1264 Lines: 43 On 11/7/2016 11:06 AM, Nicholas Mc Guire wrote: > The current code is effectively equivalent to list_first_entry_or_null() > so simply switch and simplify the code. > > Fixes: 9c39ddc60ee9 ("USB: s3c-hsotg: Fix stall condition processing") > Signed-off-by: Nicholas Mc Guire > --- > Found by simple coccinelle scanner > > Compile tested with: x86_64_defconfig + CONFIG_USB_DWC2=m, > CONFIG_USB_DWC2_PERIPHERAL=y > > Patch is against 4.9.0-rc2 (localversion-next is next-20161028) > > drivers/usb/dwc2/gadget.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > index 24fbebc..9ac8ca0 100644 > --- a/drivers/usb/dwc2/gadget.c > +++ b/drivers/usb/dwc2/gadget.c > @@ -1099,10 +1099,8 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg, > */ > static struct dwc2_hsotg_req *get_ep_head(struct dwc2_hsotg_ep *hs_ep) > { > - if (list_empty(&hs_ep->queue)) > - return NULL; > - > - return list_first_entry(&hs_ep->queue, struct dwc2_hsotg_req, queue); > + return list_first_entry_or_null(&hs_ep->queue, > + struct dwc2_hsotg_req, queue); > } > > /** > Hi, The same is already queued in Felipe's testing/next. Regards, John