Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2305234rdb; Fri, 8 Dec 2023 04:38:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLt/c6UHHP2/jJaDs0redNFeHS692liOrwqBEuMAslGtn/+gp246IGEzw+TxPjp2V+0Foo X-Received: by 2002:a17:903:2282:b0:1d0:9979:7be5 with SMTP id b2-20020a170903228200b001d099797be5mr1139725plh.31.1702039089715; Fri, 08 Dec 2023 04:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702039089; cv=none; d=google.com; s=arc-20160816; b=mdtUudw+y9TH6gYjhXEPjIlG5DXF+qIMMX9bym+G0hVxfg2DH8MiD8mfMZ1ISebWHS Yar40cP9wBknhVHl68AGO8ytiYUTzM0t9qxJIeC7ofK3DpwTBCm7nUr5Wqjstmvl88VD RzKYyWnYXbDLZtxdArdJctRF+D1wntpshNxOcwFaPf1qXNmWotpwyrdJJAfJevAgWGN4 Tff8b30DeRsWvLenZUoXMXfuuMMXyFQZpazs++lOdUNGH/QsrGa8B8XR0Ye3PNUHRMTY 7sPd6AKCXZHwoJ/iXS/lyZZp3OINvBpmZZH2LiQzFeGNB1gmccS1adONrv7MwtDjIm7U ItdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=61QDanNd4TFNwgA+VApoSXSn+xw5NuMjNPBddFzIYQE=; fh=qB6QIdTf2qqgD+OIde+fA94bI5YEVnyz1OxZrnq5GVk=; b=DJSphmG1hZznq4HutQFbij9zbrNODj222+GoehOmt56iEckZAFBerstSL9uyUUULek r9PpIPQEFBz7CTk3nedeoZLUSWEcnC9gt8Ay9GXHM4NBqX56L7RZmdYXgD/EEr7lv6tj 6wDj4AprXIj+YvxBERrW9bSu5/nPqtuhz0SWdK91Q+7sHpKyILLnKv/HbvYtmhMCts5S PXZe7kFlQLrSaL/uH2DF9o/SNK1YyWrm4A4J0pG0iNdObvG6m4Y0xUx7wFcE8iTmquyf ojuK/ZtAv1YrDc0iiGnXfR3RMPdeRMzzF+eO2igEIKpyTt3qZMCfBFqlHQi8N9qbgc7Y lKaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGRLCeNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b32-20020a631b60000000b005b958401e4fsi1540754pgm.418.2023.12.08.04.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 04:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGRLCeNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id AD7D1808D693; Fri, 8 Dec 2023 04:37:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573723AbjLHMhT (ORCPT + 99 others); Fri, 8 Dec 2023 07:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573740AbjLHMhQ (ORCPT ); Fri, 8 Dec 2023 07:37:16 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D661E0 for ; Fri, 8 Dec 2023 04:37:22 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4FE1C433C7; Fri, 8 Dec 2023 12:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702039042; bh=gqQmFdVmCQcNd8eKCMxCHIDAeVXnQ1wKVZgIjb/cu7E=; h=From:To:Cc:Subject:Date:From; b=rGRLCeNzGWF3GpJdrEeFpcxOAAO3hSBToCupmGi0kWqtNUDaK5uGOOum3/+R1nCIG M21XLvFvzPQV0ZKl7Jptqcb67rDybpXqqQSgESiZjyKnhkEskWo8suGEWt6v3p6E5x n/X7wP1pd+75peLzsXgV0mPX/Qo1uyIl2c0yZYA30n4Rt57/0Qptu4Xf7jYFDLpp30 jT4cKNTdm5DP7S8ZneFs98UKXRVhnDCaowJZax3Uueqg57fL1MqwkWQoGp7rm4HKBs tKeWMP1ybW4TtBCJq7fcEG9t7g7zl/MfIXByv4Wva7GlYSk38LyyI0EbtdErq3rBml EIClylnvCZCjw== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rBa7P-0007o9-1V; Fri, 08 Dec 2023 13:38:12 +0100 From: Johan Hovold To: Heikki Krogerus , Greg Kroah-Hartman Cc: Neil Armstrong , Dmitry Baryshkov , Konrad Dybcio , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH] usb: typec: ucsi: fix gpio-based orientation detection Date: Fri, 8 Dec 2023 13:36:02 +0100 Message-ID: <20231208123603.29957-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 08 Dec 2023 04:37:49 -0800 (PST) Fix the recently added connector sanity check which was off by one and prevented orientation notifications from being handled correctly for the second port when using GPIOs to determine orientation. Fixes: c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events") Cc: Neil Armstrong Signed-off-by: Johan Hovold --- I found this one through inspection when skimming the driver. Johan drivers/usb/typec/ucsi/ucsi_glink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c index db6e248f8208..4853141cd10c 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -228,7 +228,7 @@ static void pmic_glink_ucsi_notify(struct work_struct *work) con_num = UCSI_CCI_CONNECTOR(cci); if (con_num) { - if (con_num < PMIC_GLINK_MAX_PORTS && + if (con_num <= PMIC_GLINK_MAX_PORTS && ucsi->port_orientation[con_num - 1]) { int orientation = gpiod_get_value(ucsi->port_orientation[con_num - 1]); -- 2.41.0