]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
video: Add parentheses around VNBYTES() macro
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 26 Jul 2023 06:54:08 +0000 (09:54 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 8 Aug 2023 21:05:43 +0000 (17:05 -0400)
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@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/video.h

index 269915160b4b8489a4df977a1eaecdb362c87254..66d109ca5da6e340b31df9b29f31fbf6b45e0d30 100644 (file)
@@ -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))