From patchwork Fri Dec 8 07:31:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 10101715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D279B60360 for ; Fri, 8 Dec 2017 07:40:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB2AD28AF9 for ; Fri, 8 Dec 2017 07:40:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFE1028AFB; Fri, 8 Dec 2017 07:40:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 289C928AF9 for ; Fri, 8 Dec 2017 07:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751321AbdLHHk4 (ORCPT ); Fri, 8 Dec 2017 02:40:56 -0500 Received: from mga12.intel.com ([192.55.52.136]:50957 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbdLHHk4 (ORCPT ); Fri, 8 Dec 2017 02:40:56 -0500 X-Greylist: delayed 567 seconds by postgrey-1.27 at vger.kernel.org; Fri, 08 Dec 2017 02:40:56 EST Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2017 23:31:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,376,1508828400"; d="scan'208";a="10707077" Received: from ahunter-desktop.fi.intel.com ([10.237.72.168]) by fmsmga004.fm.intel.com with ESMTP; 07 Dec 2017 23:31:27 -0800 From: Adrian Hunter To: Ulf Hansson Cc: linux-mmc , Dan Carpenter , Harjani Ritesh , Shawn Lin , Bough Chen Subject: [PATCH] mmc: cqhci: Ensure macro parameters are wrapped in parentheses Date: Fri, 8 Dec 2017 09:31:06 +0200 Message-Id: <1512718266-31261-1-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Absence of parentheses is not affecting current code, but ensure macro parameters are wrapped in parentheses. Reported-by: Dan Carpenter Fixes: adcb39141800 ("mmc: cqhci: support for command queue enabled host") Signed-off-by: Adrian Hunter --- drivers/mmc/host/cqhci.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h index 2d39d361b322..9e68286a07b4 100644 --- a/drivers/mmc/host/cqhci.h +++ b/drivers/mmc/host/cqhci.h @@ -61,9 +61,9 @@ #define CQHCI_IC_ENABLE BIT(31) #define CQHCI_IC_RESET BIT(16) #define CQHCI_IC_ICCTHWEN BIT(15) -#define CQHCI_IC_ICCTH(x) ((x & 0x1F) << 8) +#define CQHCI_IC_ICCTH(x) (((x) & 0x1F) << 8) #define CQHCI_IC_ICTOVALWEN BIT(7) -#define CQHCI_IC_ICTOVAL(x) (x & 0x7F) +#define CQHCI_IC_ICTOVAL(x) ((x) & 0x7F) /* task list base address */ #define CQHCI_TDLBA 0x20 @@ -119,31 +119,31 @@ #define CQHCI_IC_DEFAULT_ICTOVAL 1 /* attribute fields */ -#define CQHCI_VALID(x) ((x & 1) << 0) -#define CQHCI_END(x) ((x & 1) << 1) -#define CQHCI_INT(x) ((x & 1) << 2) -#define CQHCI_ACT(x) ((x & 0x7) << 3) +#define CQHCI_VALID(x) (((x) & 1) << 0) +#define CQHCI_END(x) (((x) & 1) << 1) +#define CQHCI_INT(x) (((x) & 1) << 2) +#define CQHCI_ACT(x) (((x) & 0x7) << 3) /* data command task descriptor fields */ -#define CQHCI_FORCED_PROG(x) ((x & 1) << 6) -#define CQHCI_CONTEXT(x) ((x & 0xF) << 7) -#define CQHCI_DATA_TAG(x) ((x & 1) << 11) -#define CQHCI_DATA_DIR(x) ((x & 1) << 12) -#define CQHCI_PRIORITY(x) ((x & 1) << 13) -#define CQHCI_QBAR(x) ((x & 1) << 14) -#define CQHCI_REL_WRITE(x) ((x & 1) << 15) -#define CQHCI_BLK_COUNT(x) ((x & 0xFFFF) << 16) -#define CQHCI_BLK_ADDR(x) ((x & 0xFFFFFFFF) << 32) +#define CQHCI_FORCED_PROG(x) (((x) & 1) << 6) +#define CQHCI_CONTEXT(x) (((x) & 0xF) << 7) +#define CQHCI_DATA_TAG(x) (((x) & 1) << 11) +#define CQHCI_DATA_DIR(x) (((x) & 1) << 12) +#define CQHCI_PRIORITY(x) (((x) & 1) << 13) +#define CQHCI_QBAR(x) (((x) & 1) << 14) +#define CQHCI_REL_WRITE(x) (((x) & 1) << 15) +#define CQHCI_BLK_COUNT(x) (((x) & 0xFFFF) << 16) +#define CQHCI_BLK_ADDR(x) (((x) & 0xFFFFFFFF) << 32) /* direct command task descriptor fields */ -#define CQHCI_CMD_INDEX(x) ((x & 0x3F) << 16) -#define CQHCI_CMD_TIMING(x) ((x & 1) << 22) -#define CQHCI_RESP_TYPE(x) ((x & 0x3) << 23) +#define CQHCI_CMD_INDEX(x) (((x) & 0x3F) << 16) +#define CQHCI_CMD_TIMING(x) (((x) & 1) << 22) +#define CQHCI_RESP_TYPE(x) (((x) & 0x3) << 23) /* transfer descriptor fields */ -#define CQHCI_DAT_LENGTH(x) ((x & 0xFFFF) << 16) -#define CQHCI_DAT_ADDR_LO(x) ((x & 0xFFFFFFFF) << 32) -#define CQHCI_DAT_ADDR_HI(x) ((x & 0xFFFFFFFF) << 0) +#define CQHCI_DAT_LENGTH(x) (((x) & 0xFFFF) << 16) +#define CQHCI_DAT_ADDR_LO(x) (((x) & 0xFFFFFFFF) << 32) +#define CQHCI_DAT_ADDR_HI(x) (((x) & 0xFFFFFFFF) << 0) struct cqhci_host_ops; struct mmc_host;