aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2017-10-25 07:25:09 -0400
committerMark Brown <broonie@kernel.org>2017-10-25 08:00:03 -0400
commit54e2fc28d9cf1be7dd2ebe74b20dc20cc2a3e55d (patch)
tree0529a9106aefb1366c480348b81e446e3db585a3
parent8955b26d227263a0938daae77f981da927e19513 (diff)
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@oracle.com> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-sprd-adi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c
index 6a5ff3003044..5993bdbf79e4 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)
303 writel_relaxed(chn_config, sadi->base + 303 writel_relaxed(chn_config, sadi->base +
304 REG_ADI_CHN_ADDR(chn_id)); 304 REG_ADI_CHN_ADDR(chn_id));
305 305
306 if (chn_id < 31) { 306 if (chn_id < 32) {
307 value = readl_relaxed(sadi->base + REG_ADI_CHN_EN); 307 value = readl_relaxed(sadi->base + REG_ADI_CHN_EN);
308 value |= BIT(chn_id); 308 value |= BIT(chn_id);
309 writel_relaxed(value, sadi->base + REG_ADI_CHN_EN); 309 writel_relaxed(value, sadi->base + REG_ADI_CHN_EN);