From mboxrd@z Thu Jan 1 00:00:00 1970 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 4C11DEB64D9 for ; Mon, 19 Jun 2023 10:37:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229725AbjFSKhf (ORCPT ); Mon, 19 Jun 2023 06:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231299AbjFSKh0 (ORCPT ); Mon, 19 Jun 2023 06:37:26 -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 373A4102 for ; Mon, 19 Jun 2023 03:37:25 -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 B961B60B51 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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);