Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp34809234rwd; Sun, 9 Jul 2023 21:07:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFb1AkArOSmQq9ToxOC2L+ERvJqGLbemwazB0CcFVdpQd+ywf0rmv/FFWfND5pJWXKtuY1+ X-Received: by 2002:a17:907:90d5:b0:992:bd2b:d0b8 with SMTP id gk21-20020a17090790d500b00992bd2bd0b8mr8868663ejb.29.1688962046766; Sun, 09 Jul 2023 21:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688962046; cv=none; d=google.com; s=arc-20160816; b=M/ONYqZHb+HdFll+DjYUGTnlBpUHIyurcgJy6389KmZRbdCYjqbsC1VTumGg8N4yxY RuJynrEDHW11MD1hK4EMWRDBAeR5bjLHW+iYj5hAnuJamMJ63Z3iPz/u06v+JHGMlc/l usFrnxBMugtT62nf9GFuofKMn4COp6VEy6ypGyYJ6wbYaq0WijCf+k6TgQAK9Cv30rcN EVCX6r5kb7GyzRTECOCkW29kaKWkTAqjh+U3liouzPL8Rsv+eFmeaHRymszpH2dvg/Uh EYRpraVdU72+vm9vPZvb6ZecZR4Dm2GZ0sdk9q2X0PA1XAE689RyxM1jGJidtZxEdsal eSbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rD74WwM62tqvcqt0aK3xnK+/Wy/YoLESD3gezuhfbj4=; fh=xnFzuHEIReh46E3/hJB5RfFM526jhb40IC2q0mKDqRI=; b=ILl1QuUE1f5b3PZOyW6+JaIvzEQ522sEcGwru7iPq7IpddLskAOL05l684gEdi1Ye7 UI799ixGxNNlcJvkwzeXSvtnwH/gaVpXkOMH9q30dgJ7UKQYatsnOZ+No0TbU338oJTW /C8TXp3NubH2L5pXDMzc3xFhlHmcOKD3K06keu/iLZCwAUj8kZ6MdZWENFQh3ByMX6c9 GK7jxPaGKprjfI3xqpCGvVu6Slf5mS/6N2sF+RG4rbIo/O67+o059yt9MPA+nPYdiKNZ UCDG5M7cw8Fifnr7ZONMOA/VNgnlUTGy3PhFOBSQgyQO8JThLhScnw8VfUHhGTh7sH9Q f5kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UwtONS72; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a1709066c8e00b00987a947bfa1si7841551ejr.483.2023.07.09.21.07.03; Sun, 09 Jul 2023 21:07:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UwtONS72; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230084AbjGJDiy (ORCPT + 99 others); Sun, 9 Jul 2023 23:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbjGJDis (ORCPT ); Sun, 9 Jul 2023 23:38:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70A49B7; Sun, 9 Jul 2023 20:38:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 04CD96068C; Mon, 10 Jul 2023 03:38:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 437F3C433C8; Mon, 10 Jul 2023 03:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688960326; bh=lMGkb6vcjaJLddWMIbgP/aSewHMop7UBQMjE9P34SE0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UwtONS72051QwGae299V1XoWZ8cIDSJ2ALc8e0b+xRQC7BFtPDQR6GszTIpYdC3wI wwkf/LhTv9su3bw2YXlTc89a2KDsQdlLfia9fahZ63mrCseWPMLdbmYpHVdE1xC/h1 WsTYv7NiJrd1dxOUKsdC8jG/q2nLR0SUfghA5vbxHvD4XTsZESvw+KXyugK3cl7Csn MkVxkqPhz7VbQphERMLZ6b4Ns68Sy1mE5nYJgA64TmfB3UN97E2Lr8XT7goN30X9ZD 8IzNCs/Mnx86uL7neBTAcnsKpmnlshffLUSYl9cjCs6JPPyN4laJXoU5DyzFRHnehy fRwDsorX8+W0A== Date: Mon, 10 Jul 2023 11:38:34 +0800 From: Peter Chen To: Frank Li Cc: Thinh.Nguyen@synopsys.com, andriy.shevchenko@linux.intel.com, gregkh@linuxfoundation.org, imx@lists.linux.dev, jgilab@gmail.com, jun.li@nxp.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, quic_eserrao@quicinc.com, quic_prashk@quicinc.com, r-gunasekaran@ti.com, rogerq@kernel.org Subject: Re: [PATCH v2 2/2] usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config Message-ID: <20230710033834.GG2418446@nchen-desktop> References: <20230707230015.494999-1-Frank.Li@nxp.com> <20230707230015.494999-2-Frank.Li@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230707230015.494999-2-Frank.Li@nxp.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23-07-07 19:00:15, Frank Li wrote: > Previously, the cdns3_gadget_check_config() function in the cdns3 driver > mistakenly calculated the ep_buf_size by considering only one > configuration's endpoint information because "claimed" will be clear after > call usb_gadget_check_config(). > > The fix involves checking the private flags EP_CLAIMED instead of relying > on the "claimed" flag. > > Fixes: dce49449e04f ("usb: cdns3: allocate TX FIFO size according to composite EP number") > Reported-by: Ravi Gunasekaran > Signed-off-by: Frank Li > --- > drivers/usb/cdns3/cdns3-gadget.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c > index ccfaebca6faa..3326955f6991 100644 > --- a/drivers/usb/cdns3/cdns3-gadget.c > +++ b/drivers/usb/cdns3/cdns3-gadget.c > @@ -2999,12 +2999,14 @@ static int cdns3_gadget_udc_stop(struct usb_gadget *gadget) > static int cdns3_gadget_check_config(struct usb_gadget *gadget) > { > struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget); > + struct cdns3_endpoint *priv_ep; > struct usb_ep *ep; > int n_in = 0; > int total; > > list_for_each_entry(ep, &gadget->ep_list, ep_list) { > - if (ep->claimed && (ep->address & USB_DIR_IN)) > + priv_ep = ep_to_cdns3_ep(ep); > + if ((priv_ep->flags & EP_CLAIMED) && (ep->address & USB_DIR_IN)) > n_in++; > } Acked-by: Peter Chen -- Thanks, Peter Chen