1
0
Fork 0

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: 7e2903cb91 ("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>
hifive-unleashed-5.1
Baolin Wang 2017-10-25 19:25:09 +08:00 committed by Mark Brown
parent 8955b26d22
commit 54e2fc28d9
1 changed files with 1 additions and 1 deletions

View File

@ -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);