[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <501d5362189cd3ec99e52082827f5d40a220cc3d.1508930323.git.baolin.wang@linaro.org>
Date: Wed, 25 Oct 2017 19:25:09 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: broonie@...nel.org
Cc: dan.carpenter@...cle.com, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org, baolin.wang@...aro.org
Subject: [PATCH] spi: sprd: Fix the possible negative value of BIT()
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 <dan.carpenter@...cle.com>
Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
---
drivers/spi/spi-sprd-adi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
--
1.9.1
Powered by blists - more mailing lists