From 2b961c51f4d35c45116b21936b563cbb78fba540 Mon Sep 17 00:00:00 2001 From: Chunyan Zhang Date: Tue, 24 Aug 2021 15:02:11 +0800 Subject: [PATCH] spi: sprd: Make sure offset not equal to slave address size The slave register offset shouldn't equal to the max slave address which ADI can support to access. Signed-off-by: Chunyan Zhang Link: https://lore.kernel.org/r/20210824070212.2089255-2-zhang.lyra@gmail.com Signed-off-by: Mark Brown --- 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 abdad1e..06af519 100644 --- a/drivers/spi/spi-sprd-adi.c +++ b/drivers/spi/spi-sprd-adi.c @@ -119,7 +119,7 @@ struct sprd_adi { static int sprd_adi_check_addr(struct sprd_adi *sadi, u32 reg) { - if (reg > ADI_SLAVE_ADDR_SIZE) { + if (reg >= ADI_SLAVE_ADDR_SIZE) { dev_err(sadi->dev, "slave address offset is incorrect, reg = 0x%x\n", reg); -- 2.7.4