public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] video-uclass: Fix logical-not-parentheses warning
@ 2018-04-22 13:47 Tom Rini
  2018-04-24 19:03 ` Anatolij Gustschin
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rini @ 2018-04-22 13:47 UTC (permalink / raw)
  To: u-boot

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 <sjg@chromium.org>
Cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 drivers/video/video-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index b5bb8e0efde5..93fdc6828b1e 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -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) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] video-uclass: Fix logical-not-parentheses warning
  2018-04-22 13:47 [U-Boot] [PATCH] video-uclass: Fix logical-not-parentheses warning Tom Rini
@ 2018-04-24 19:03 ` Anatolij Gustschin
  0 siblings, 0 replies; 2+ messages in thread
From: Anatolij Gustschin @ 2018-04-24 19:03 UTC (permalink / raw)
  To: u-boot

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.
> 
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Anatolij Gustschin <agust@denx.de>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  drivers/video/video-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

--
Anatolij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-24 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-22 13:47 [U-Boot] [PATCH] video-uclass: Fix logical-not-parentheses warning Tom Rini
2018-04-24 19:03 ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox