From patchwork Mon Jan 10 07:23:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 531511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B99D4C433FE for ; Mon, 10 Jan 2022 07:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240185AbiAJH3P (ORCPT ); Mon, 10 Jan 2022 02:29:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35846 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239452AbiAJH1O (ORCPT ); Mon, 10 Jan 2022 02:27:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0312611BB; Mon, 10 Jan 2022 07:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95C4BC36AED; Mon, 10 Jan 2022 07:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1641799633; bh=3/dwJjTOfy7aBth/bsOx6Zpwo8PENZBu+h2VbuE/B4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8SwMlrsnkZ5f444YPYPNlBc/tUgpE7gOM4HDSg0910c+0OscQ8t2QBb9+k72mT+X FGrBdMxMj53pGgC4FqaWUha+Z+4F5ik7mz58lAD44js2+yO9ZNpBe4xpIa7miJrz1O +jWanKYa0GsrSnZvhAJA9pvYuMduU3kVjoFwntwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 4.19 17/21] usb: mtu3: fix interval value for intr and isoc Date: Mon, 10 Jan 2022 08:23:18 +0100 Message-Id: <20220110071814.517246143@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220110071813.967414697@linuxfoundation.org> References: <20220110071813.967414697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chunfeng Yun [ Upstream commit e3d4621c22f90c33321ae6a6baab60cdb8e5a77c ] Use the Interval value from isoc/intr endpoint descriptor, no need minus one. The original code doesn't cause transfer error for normal cases, but it may have side effect with respond time of ERDY or tPingTimeout. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/20211218095749.6250-1-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/mtu3/mtu3_gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index 07a6ee8db6123..9f0c949820bf7 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -82,7 +82,7 @@ static int mtu3_ep_enable(struct mtu3_ep *mep) if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { interval = desc->bInterval; - interval = clamp_val(interval, 1, 16) - 1; + interval = clamp_val(interval, 1, 16); if (usb_endpoint_xfer_isoc(desc) && comp_desc) mult = comp_desc->bmAttributes; } @@ -94,7 +94,7 @@ static int mtu3_ep_enable(struct mtu3_ep *mep) if (usb_endpoint_xfer_isoc(desc) || usb_endpoint_xfer_int(desc)) { interval = desc->bInterval; - interval = clamp_val(interval, 1, 16) - 1; + interval = clamp_val(interval, 1, 16); mult = usb_endpoint_maxp_mult(desc) - 1; } break;