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 5396C5381 for ; Mon, 19 Jun 2023 10:37:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFCDCC433C0; Mon, 19 Jun 2023 10:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687171044; bh=E9oYiWRHZSdtD12KpMsuAKMosL2QCx7JRVE6Li+bl2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=meu3DGxCua6FE10YNfl+2xdK4qAILAAeaNwU/Iw3WugSHOiv24eCX4MVIcqAPOHXR lqhvOW4ecuDAg0aYmgjvxBrhxg3D7Q6F/MwJth9tiysXHqtEUNAYDTZ5Ta9ic5XOhN yYrGiUrr1TI671yUnuebo2rKWqQQUoQoDD+yK1dk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Benson Leung , Pavan Holla , Heikki Krogerus Subject: [PATCH 6.3 101/187] usb: typec: Fix fast_role_swap_current show function Date: Mon, 19 Jun 2023 12:28:39 +0200 Message-ID: <20230619102202.475648214@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230619102157.579823843@linuxfoundation.org> References: <20230619102157.579823843@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Pavan Holla commit 92c9c3baad6b1fd584fbabeaa4756f9b77926cb5 upstream. The current implementation mistakenly performs a & operation on the output of sysfs_emit. This patch performs the & operation before calling sysfs_emit. Fixes: 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C") Cc: stable Reported-by: Benson Leung Signed-off-by: Pavan Holla Reviewed-by: Heikki Krogerus Reviewed-by: Benson Leung Message-ID: <20230607193328.3359487-1-pholla@chromium.org> Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/pd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/typec/pd.c +++ b/drivers/usb/typec/pd.c @@ -96,7 +96,7 @@ peak_current_show(struct device *dev, st static ssize_t fast_role_swap_current_show(struct device *dev, struct device_attribute *attr, char *buf) { - return sysfs_emit(buf, "%u\n", to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3; + return sysfs_emit(buf, "%u\n", (to_pdo(dev)->pdo >> PDO_FIXED_FRS_CURR_SHIFT) & 3); } static DEVICE_ATTR_RO(fast_role_swap_current);