linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbdev: avoid int-in-bool-context warning
@ 2017-05-11 12:47 ` Arnd Bergmann
  2017-06-14 10:04   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-05-11 12:47 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Andrew Morton
  Cc: Arnd Bergmann, linux-fbdev, linux-kernel

gcc-7 suspects this code might be wrong because we use the
result of a multiplication as a bool:

drivers/video/fbdev/core/fbmon.c: In function 'fb_edid_add_monspecs':
drivers/video/fbdev/core/fbmon.c:1051:84: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]

It's actually fine, so let's add a comparison to zero to make
that clear to the compiler too.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/video/fbdev/core/fbmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index eaa6bab21839..99e45a49e435 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -1048,7 +1048,7 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
 
 	for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE;
 	     i++, block += DETAILED_TIMING_DESCRIPTION_SIZE)
-		if (PIXEL_CLOCK)
+		if (PIXEL_CLOCK != 0)
 			edt[num++] = block - edid;
 
 	/* Yikes, EDID data is totally useless */
-- 
2.9.0

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

* Re: [PATCH] fbdev: avoid int-in-bool-context warning
  2017-05-11 12:47 ` [PATCH] fbdev: avoid int-in-bool-context warning Arnd Bergmann
@ 2017-06-14 10:04   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-06-14 10:04 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Andrew Morton, linux-fbdev, linux-kernel

On Thursday, May 11, 2017 02:47:01 PM Arnd Bergmann wrote:
> gcc-7 suspects this code might be wrong because we use the
> result of a multiplication as a bool:
> 
> drivers/video/fbdev/core/fbmon.c: In function 'fb_edid_add_monspecs':
> drivers/video/fbdev/core/fbmon.c:1051:84: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
> 
> It's actually fine, so let's add a comparison to zero to make
> that clear to the compiler too.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch queued for 4.12, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

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

end of thread, other threads:[~2017-06-14 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170511124723epcas2p15bf0763aae25607197e46d1918f6e4df@epcas2p1.samsung.com>
2017-05-11 12:47 ` [PATCH] fbdev: avoid int-in-bool-context warning Arnd Bergmann
2017-06-14 10:04   ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).