From patchwork Thu Mar 18 16:45:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 404539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 318F0C433E9 for ; Thu, 18 Mar 2021 16:46:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00A0C64F6B for ; Thu, 18 Mar 2021 16:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232065AbhCRQpp (ORCPT ); Thu, 18 Mar 2021 12:45:45 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:44745 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231279AbhCRQpT (ORCPT ); Thu, 18 Mar 2021 12:45:19 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lMvlq-0007pz-5X; Thu, 18 Mar 2021 16:45:14 +0000 From: Colin King To: Arend van Spriel , Franky Lin , Hante Meuleman , Chi-hsien Lin , Wright Feng , Chung-hsien Hsu , Kalle Valo , "David S . Miller" , Jakub Kicinski , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] brcmsmac: fix shift on 4 bit masked value Date: Thu, 18 Mar 2021 16:45:13 +0000 Message-Id: <20210318164513.19600-1-colin.king@canonical.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Colin Ian King The calculation of offtune_val seems incorrect, the u16 value in pi->tx_rx_cal_radio_saveregs[2] is being masked with 0xf0 and then shifted 8 places right so that always ends up as a zero result. I believe the intended shift was 4 bits to the right. Fix this. [Note: not tested, I don't have the H/W] Addresses-Coverity: ("Operands don't affect result") Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers") Signed-off-by: Colin Ian King --- drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c index 8580a2754789..2c04bae6e21c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c @@ -26329,7 +26329,7 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) offtune_val = (pi->tx_rx_cal_radio_saveregs - [2] & 0xF0) >> 8; + [2] & 0xF0) >> 4; offtune_val = (offtune_val <= 0x7) ? 0xF : 0;