From patchwork Mon Aug 3 21:15:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 6933191 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE2359F373 for ; Mon, 3 Aug 2015 21:16:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C8FEA2050B for ; Mon, 3 Aug 2015 21:16:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FB1B204E2 for ; Mon, 3 Aug 2015 21:16:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932448AbbHCVQI (ORCPT ); Mon, 3 Aug 2015 17:16:08 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:35555 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932420AbbHCVQG (ORCPT ); Mon, 3 Aug 2015 17:16:06 -0400 Received: by obbop1 with SMTP id op1so109024593obb.2 for ; Mon, 03 Aug 2015 14:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=40/BklT09IQBnNZgIhG08yuOrfn+x4yuJmiaKTTaBfQ=; b=PwE8WxLGnfEQlTGk+LymRCgh2j2PujcouRIIw4AEMvruk+bo8OJnDsOBGz0qbhoqEr ih6xqyPKf28oh11TTsitmYs2elt0C7LDSdXHIBrwrgXVroLNEJcGgBKmkvnO7iDCpJkJ llB5LrAIwJIPECfssK/NU74x3hZEXbchRvup7vPxdVZvUkDbMFeo4zlhI45iNN/4YiPB G6nh/+gC1W0yavxGSuNWr5k1wIflPEGSnVOQZQK2/VuywU+L8ZEFxToVml6OurYw8EjA JT7JjfGjRGzdcY1djscjExfjLtkJy5kT4tmQd8WqENjP22B1lMTRZ31YnhJaimb/tvSx Lanw== X-Received: by 10.182.210.194 with SMTP id mw2mr68118obc.59.1438636566052; Mon, 03 Aug 2015 14:16:06 -0700 (PDT) Received: from linux.site (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id x7sm8099717obp.22.2015.08.03.14.16.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Aug 2015 14:16:05 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Larry Finger , David Binderman Subject: [PATCH NEXT] rtlwifi: rtl8192c-common: Fix two typos Date: Mon, 3 Aug 2015 16:15:53 -0500 Message-Id: <1438636553-28465-1-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In this driver, two variables are masked by one quantity, and then tested against a second number with more bits that the mask. Accordingly, the test always fails. To minimize the possibility of such typos, a symbolic definition of the mask is created and used. The separate load and mask operations are also combined into a single statement. Reported-by: David Binderman Signed-off-by: Larry Finger Cc: David Binderman --- drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c index 0aca6f4..61c857b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c @@ -39,6 +39,7 @@ #define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) #define BT_RSSI_STATE_BG_EDCA_LOW BIT_OFFSET_LEN_MASK_32(3, 1) #define BT_RSSI_STATE_TXPOWER_LOW BIT_OFFSET_LEN_MASK_32(4, 1) +#define BT_MASK 0x00ffffff #define RTLPRIV (struct rtl_priv *) #define GET_UNDECORATED_AVERAGE_RSSI(_priv) \ @@ -1536,13 +1537,11 @@ static bool rtl92c_bt_state_change(struct ieee80211_hw *hw) return false; bt_state = rtl_read_byte(rtlpriv, 0x4fd); - bt_tx = rtl_read_dword(rtlpriv, 0x488); - bt_tx = bt_tx & 0x00ffffff; - bt_pri = rtl_read_dword(rtlpriv, 0x48c); - bt_pri = bt_pri & 0x00ffffff; + bt_tx = rtl_read_dword(rtlpriv, 0x488) & BT_MASK; + bt_pri = rtl_read_dword(rtlpriv, 0x48c) & BT_MASK; polling = rtl_read_dword(rtlpriv, 0x490); - if (bt_tx == 0xffffffff && bt_pri == 0xffffffff && + if (bt_tx == BT_MASK && bt_pri == BT_MASK && polling == 0xffffffff && bt_state == 0xff) return false;