Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752148AbdIEQcx (ORCPT ); Tue, 5 Sep 2017 12:32:53 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51248 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751863AbdIEQct (ORCPT ); Tue, 5 Sep 2017 12:32:49 -0400 From: Colin King To: Greg Kroah-Hartman , simran singhal , Derek Robson , devel@driverdev.osuosl.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: rtl8192u: fix incorrect mask when calculating TxPowerLevelCCK Date: Tue, 5 Sep 2017 17:32:47 +0100 Message-Id: <20170905163247.21875-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1210 Lines: 29 From: Colin Ian King The mask of 0xff and right shift of 8 bits on ret always results in a value of 0 for TxPowerLevelCCK. I believe this should be a mask of 0xff00, however I do not have the hardware at hand to test this out, so there is a distinct possibility I may be wrong on this. Detected by CoverityScan CID#1357110 ("Operands don't affect result") Signed-off-by: Colin Ian King --- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 46b3f19e0878..ecc887636173 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2510,7 +2510,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev) ret = eprom_read(dev, (EEPROM_TxPwIndex_CCK >> 1)); if (ret < 0) return ret; - priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8; + priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff00) >> 8; } else priv->EEPROMTxPowerLevelCCK = 0x10; RT_TRACE(COMP_EPROM, "CCK Tx Power Levl: 0x%02x\n", priv->EEPROMTxPowerLevelCCK); -- 2.14.1