From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24C9A1F6696; Tue, 3 Dec 2024 15:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733239489; cv=none; b=STYeEMch73N/sZax/o5fNRH5HxPyvqWBRdoMjnp4a4gnkUxuPdrJxlYBb80uL4MTS59UV1j3yI5EgC2/3xwCpW7fPGFh0eSM93IZ82IHKYXy487OiOZfO/UK6vt1SuyXTvdpFl3ifO2AWVWJSHA3AcwDorxB7ddZr5p3hEemi7E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733239489; c=relaxed/simple; bh=h5zH+JrvxyjRU9NUuKUmn9ANfeRl+KYpEsD4udJXojw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gIFOKK82vhkhGzHRZArfNq9PKdkV9oTSE6Blf5dZ2C+EJbOP3BjHd3BWA+a32GpQe5x8q0dCmJPoaVT71Q6IzhJKPQ5kzwQHxmaaLSz9iNtl8FwtIvejofUTM/y22kIvM35KuDQMDwZen0HpIyx7TZgr/dKDr5YdfyJmd8E1jkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oauvkyH5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oauvkyH5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1597C4CECF; Tue, 3 Dec 2024 15:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733239489; bh=h5zH+JrvxyjRU9NUuKUmn9ANfeRl+KYpEsD4udJXojw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oauvkyH5ULQTPxXlXjIaLs8aWAGxO7c2aSz3C+Tp52A2AOOYGbimxTslPJHq8DuUQ BQcTKIWcdbIPXZCRJZ8u1og1Cj/ojrocz31op+JoBzYcAFoCbo8IodONH24bo0M98N TnTF2cMAAsInutWfWuceaU7AaOlRvX3+Nc7GSrzg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abel Vesa , Neil Armstrong , Johan Hovold , Dmitry Baryshkov Subject: [PATCH 6.11 631/817] usb: typec: ucsi: glink: fix off-by-one in connector_status Date: Tue, 3 Dec 2024 15:43:23 +0100 Message-ID: <20241203144020.568006332@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241203143955.605130076@linuxfoundation.org> References: <20241203143955.605130076@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Baryshkov commit 4a22918810980897393fa1776ea3877e4baf8cca upstream. UCSI connector's indices start from 1 up to 3, PMIC_GLINK_MAX_PORTS. Correct the condition in the pmic_glink_ucsi_connector_status() callback, fixing Type-C orientation reporting for the third USB-C connector. Fixes: 76716fd5bf09 ("usb: typec: ucsi: glink: move GPIO reading into connector_status callback") Cc: stable@vger.kernel.org Reported-by: Abel Vesa Reviewed-by: Neil Armstrong Reviewed-by: Johan Hovold Tested-by: Johan Hovold Signed-off-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20241109-ucsi-glue-fixes-v2-1-8b21ff4f9fbe@linaro.org Signed-off-by: Greg Kroah-Hartman --- 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 3e4d88ab338e..2e12758000a7 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -185,7 +185,7 @@ static void pmic_glink_ucsi_connector_status(struct ucsi_connector *con) struct pmic_glink_ucsi *ucsi = ucsi_get_drvdata(con->ucsi); int orientation; - if (con->num >= PMIC_GLINK_MAX_PORTS || + if (con->num > PMIC_GLINK_MAX_PORTS || !ucsi->port_orientation[con->num - 1]) return; -- 2.47.1