Skip to contentSkip to conversation

video-uclass: Fix logical-not-parentheses warning

PATCH New Tom Rini 2 participants 2 messages Apr 22, 2018 – Apr 24, 2018 Framebuffer layer

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 video-uclass: Fix logical-not-parentheses warning

With clang-4.0 and later we see:
warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]

        if ((!gd->flags & GD_FLG_RELOC))
             ^          ~

And while the compiler suggests adding parenthesis around gd->flags, a reading of the code says that we want to know when GD_FLG_RELOC is not set and then return.

Cc Simon Glass <[email protected]>
Cc Anatolij Gustschin <[email protected]>
---
 drivers/video/video-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/video-uclass.c +1 -1
index b5bb8e0efde5..93fdc6828b1e 100644
@@ -272,7 +272,7 @@ static int video_post_bind(struct udevice *dev)
 	ulong size;
 
 	/* Before relocation there is nothing to do here */
-	if ((!gd->flags & GD_FLG_RELOC))
+	if (!(gd->flags & GD_FLG_RELOC))
 		return 0;
 	size = alloc_fb(dev, &addr);
 	if (addr < gd->video_bottom) {
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 video-uclass: Fix logical-not-parentheses warning

Quoted 10 lines · On Sun, 22 Apr 2018 09:47:48 -0400 Tom Rini trini at konsulko.com wrote:

With clang-4.0 and later we see:
warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]

        if ((!gd->flags & GD_FLG_RELOC))
             ^          ~

And while the compiler suggests adding parenthesis around gd->flags, a reading of the code says that we want to know when GD_FLG_RELOC is not set and then return.

Quoted 6 lines
Cc Simon Glass <[email protected]>
Cc Anatolij Gustschin <[email protected]>
---
 drivers/video/video-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-video/master, thanks!

--
Anatolij