[PATCH] video: Add parentheses around VNBYTES() macro

Dan Carpenter dan.carpenter at linaro.org
Wed Jul 26 08:54:08 CEST 2023


The VNBYTES() macro needs to have parentheses to prevent some (harmless)
macro expansion bugs.  The VNBYTES() macro is used like this:

	VID_TO_PIXEL(x) * VNBYTES(vid_priv->bpix)

The * operation is done before the / operation.  It still ends up with
the same results, but it's not ideal.

Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
---
 include/video.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/video.h b/include/video.h
index 9729fa348aa5..b364bf91825f 100644
--- a/include/video.h
+++ b/include/video.h
@@ -58,7 +58,7 @@ enum video_log2_bpp {
  * Convert enum video_log2_bpp to bytes and bits. Note we omit the outer
  * brackets to allow multiplication by fractional pixels.
  */
-#define VNBYTES(bpix)	(1 << (bpix)) / 8
+#define VNBYTES(bpix)	((1 << (bpix)) / 8)
 
 #define VNBITS(bpix)	(1 << (bpix))
 
-- 
2.39.2



More information about the U-Boot mailing list