diff mbox series

of: Drop superfluous ULL suffix for ~0

Message ID 20201102105422.752202-1-geert+renesas@glider.be
State Accepted
Headers show
Series of: Drop superfluous ULL suffix for ~0 | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 1 warnings, 8 lines checked

Commit Message

Geert Uytterhoeven Nov. 2, 2020, 10:54 a.m. UTC
There is no need to specify a "ULL" suffix for "all bits set": "~0" is
sufficient, and works regardless of type.  In fact adding the suffix
makes the code more fragile.

Fixes: 48ab6d5d1f096d6f ("dma-mapping: fix 32-bit overflow with CONFIG_ARM_LPAE=n")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/of/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Torvalds Nov. 2, 2020, 5:33 p.m. UTC | #1
On Mon, Nov 2, 2020 at 2:54 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> There is no need to specify a "ULL" suffix for "all bits set": "~0" is
> sufficient, and works regardless of type.  In fact adding the suffix
> makes the code more fragile.

I took this directly, since it was triggered by my code pattern rant.

Thanks,
                Linus
diff mbox series

Patch

diff --git a/drivers/of/device.c b/drivers/of/device.c
index 3a469c79e6b05de4..aedfaaafd3e7edb7 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -112,7 +112,7 @@  int of_dma_configure_id(struct device *dev, struct device_node *np,
 		u64 dma_end = 0;
 
 		/* Determine the overall bounds of all DMA regions */
-		for (dma_start = ~0ULL; r->size; r++) {
+		for (dma_start = ~0; r->size; r++) {
 			/* Take lower and upper limits */
 			if (r->dma_start < dma_start)
 				dma_start = r->dma_start;