diff mbox series

dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL

Message ID 20241028093413.1145820-1-zhoubinbin@loongson.cn (mailing list archive)
State Accepted
Commit 4b65d5322e1d8994acfdb9b867aa00bdb30d177b
Headers show
Series dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL | expand

Commit Message

Binbin Zhou Oct. 28, 2024, 9:34 a.m. UTC
Fix the following smatch static checker warning:

drivers/dma/loongson2-apb-dma.c:189 ls2x_dma_write_cmd()
warn: was expecting a 64 bit value instead of '~(((0)) + (((~((0))) - (((1)) << (0)) + 1) & (~((0)) >> ((8 * 4) - 1 - (4)))))'

The GENMASK macro used "unsigned long", which caused build issues when
using a 32-bit toolchain because it would try to access bits > 31. This
patch switches GENMASK to GENMASK_ULL, which uses "unsigned long long".

Fixes: 71e7d3cb6e55 ("dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/87cdc025-7246-4548-85ca-3d36fdc2be2d@stanley.mountain/
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/dma/loongson2-apb-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 8974f34de2ef173470a596a4dee22f4922583d1b

Comments

Vinod Koul Dec. 2, 2024, 5:30 p.m. UTC | #1
On Mon, 28 Oct 2024 17:34:13 +0800, Binbin Zhou wrote:
> Fix the following smatch static checker warning:
> 
> drivers/dma/loongson2-apb-dma.c:189 ls2x_dma_write_cmd()
> warn: was expecting a 64 bit value instead of '~(((0)) + (((~((0))) - (((1)) << (0)) + 1) & (~((0)) >> ((8 * 4) - 1 - (4)))))'
> 
> The GENMASK macro used "unsigned long", which caused build issues when
> using a 32-bit toolchain because it would try to access bits > 31. This
> patch switches GENMASK to GENMASK_ULL, which uses "unsigned long long".
> 
> [...]

Applied, thanks!

[1/1] dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL
      commit: 4b65d5322e1d8994acfdb9b867aa00bdb30d177b

Best regards,
diff mbox series

Patch

diff --git a/drivers/dma/loongson2-apb-dma.c b/drivers/dma/loongson2-apb-dma.c
index 367ed34ce4da..c528f02b9f84 100644
--- a/drivers/dma/loongson2-apb-dma.c
+++ b/drivers/dma/loongson2-apb-dma.c
@@ -31,7 +31,7 @@ 
 #define LDMA_ASK_VALID		BIT(2)
 #define LDMA_START		BIT(3) /* DMA start operation */
 #define LDMA_STOP		BIT(4) /* DMA stop operation */
-#define LDMA_CONFIG_MASK	GENMASK(4, 0) /* DMA controller config bits mask */
+#define LDMA_CONFIG_MASK	GENMASK_ULL(4, 0) /* DMA controller config bits mask */
 
 /* Bitfields in ndesc_addr field of HW descriptor */
 #define LDMA_DESC_EN		BIT(0) /*1: The next descriptor is valid */