From patchwork Wed Oct 25 11:25:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 117104 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp728757qgn; Wed, 25 Oct 2017 04:26:06 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TxvjNo+2rN/30tDz4d63Ta7qHSCLlW6v8F4KnsEr7N+AybjQ7a2fzu5zJXy1sUkGwC6lZp X-Received: by 10.99.96.7 with SMTP id u7mr1688239pgb.183.1508930766678; Wed, 25 Oct 2017 04:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508930766; cv=none; d=google.com; s=arc-20160816; b=IgOl1fBH6Yf26ftIWW9fykvcKU7GSNaiH1FoPS1vj7Lrkiio4PqQku35q2JUkXp1M/ +P+pSSdPFLZK2tP3DvEKMPJNQuZzucC8GHr6BeR35t05armMRA+Aj7QgPtI1G5HbnSAP uKwK2WZcA1egEc45H68wsiefVUxDBeFecZw3XPk6id7GAmBrBGvCrsRxsbSvhB+LEJbE UQ5IioMrdEvpNj+4O67k90efl4j7UQZlWJVEm+c1q9hiXg6msspdFyjTJz64gT+cNvin +MjQl31QvtPtgl0sd2dFlW69vTbesRLK5k3l6wH/JAWjOkKpfMHlgmz/JR9PGFFtJJtq AB7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=GnxNI9HMTpR6dN2n8iQBz42DCWcA0WI7NNz1edgJrpo=; b=lO1XtqJIv6C623IjlpMn0aj+KH1h8ACKZahJ50CPCf5w02lH0jz8LJW1gw2gn0XvKc V62vPz/A9JLFfzuC8/P2Z38kJ7WDgzU42s1bQjfkRToWFD/pSNNUwE8uIrrMtUgw3gVq XwpygwGJTXB0igmezqVrOfPm+k1UAOrm7W7TNq/ZPjthnF3ReIpaXEjQb4tI589+93kw dJAOM1n345rcT6ZFfwphzoalLY2lbjgSvabi3JI4CPdsHWXalKvWqgMRjTyVVtGh7Go1 DGpB8tqK7+BYsZGGYtNjwM0K3XqD9m5u6ab21EzitokBQ+lyip1MhW5O8ULjsJX0S5qG noIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Lvjxy40c; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si1460944plk.427.2017.10.25.04.26.06; Wed, 25 Oct 2017 04:26:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Lvjxy40c; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751820AbdJYL0F (ORCPT + 1 other); Wed, 25 Oct 2017 07:26:05 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:55728 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751160AbdJYL0F (ORCPT ); Wed, 25 Oct 2017 07:26:05 -0400 Received: by mail-pf0-f194.google.com with SMTP id 17so22001204pfn.12 for ; Wed, 25 Oct 2017 04:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=FyNN3TVnzux9pvG+BJcgBJD06fS6fTR3fk3HpXCsRLE=; b=Lvjxy40cwrASqMc1WXaomHuNIRBuZZCCkEJ+vEVzl5/59Ul+T8FbQeKkf0RNboblGh n/S7jhpklmuZ0hhrr8hCFOl6ZG3SJKm3D+FcCE+Y5zXb1T9sgjy8dDXhPYUxmXj59vHB M/fJvC5pEDORJDBjUmEPopPzgOt+GWNxzR50Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FyNN3TVnzux9pvG+BJcgBJD06fS6fTR3fk3HpXCsRLE=; b=aVsGY4LIHKsSPwjDL9zcEIwBjElxDvDrVXr6TEKYH7Erla8JmuQH+6ARHtDdB2cH7P 64x7aaC6LdSRdSuevZOroI9xO2HAo1NbVsFPLbjtkMgXVw1bwZpP6frFnVS1TdKjJpS8 rnQis4WzHN7Sbs4p+vN+sZ2n9iQPbhsf1hj68AutmMLs0hi5B1FQqJNC7E7oD/9gulg5 UEBUqTwEisDeJrAJBvRBtDaGvqZRMK5gZUTZ55T6Ae1Rtbb5jaJfxBKcVZ/Y1L/IckrY y49xG6CkKo6Gv68TqaVW1/RGKhD0PKl2hxShVV3rTVAHsKL95ZNIEFMn9ezc/93S5SN4 cQkQ== X-Gm-Message-State: AMCzsaWkQ4teUO2oR98KQm5cYY+NYZwQwWmoMDjnnvgWK6qB8+zM9l6J etwHXeMbWg+PT/p7+Ev5uMgakg== X-Received: by 10.84.202.194 with SMTP id q2mr1517041plh.19.1508930764596; Wed, 25 Oct 2017 04:26:04 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id p12sm4486457pgd.0.2017.10.25.04.25.59 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Oct 2017 04:26:04 -0700 (PDT) From: Baolin Wang To: broonie@kernel.org Cc: dan.carpenter@oracle.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH] spi: sprd: Fix the possible negative value of BIT() Date: Wed, 25 Oct 2017 19:25:09 +0800 Message-Id: <501d5362189cd3ec99e52082827f5d40a220cc3d.1508930323.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org When enabling the ADI hardware channels, if the channel id is 31, then we will get one negative value -1 for BIT() macro, which will write incorrect value to register. Fixes: 7e2903cb91df ("spi: Add ADI driver for Spreadtrum platform") Reported-by: Dan Carpenter Signed-off-by: Baolin Wang --- drivers/spi/spi-sprd-adi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c index 6a5ff30..5993bdb 100644 --- a/drivers/spi/spi-sprd-adi.c +++ b/drivers/spi/spi-sprd-adi.c @@ -303,7 +303,7 @@ static void sprd_adi_hw_init(struct sprd_adi *sadi) writel_relaxed(chn_config, sadi->base + REG_ADI_CHN_ADDR(chn_id)); - if (chn_id < 31) { + if (chn_id < 32) { value = readl_relaxed(sadi->base + REG_ADI_CHN_EN); value |= BIT(chn_id); writel_relaxed(value, sadi->base + REG_ADI_CHN_EN);