[PATCH] drm: xlnx: zynqmp_disp: Fix WARN_ON build warning

Palmer Dabbelt palmer at rivosinc.com
Tue May 21 07:28:15 PDT 2024


From: Palmer Dabbelt <palmer at rivosinc.com>

Without this I get warnings along the lines of

    drivers/gpu/drm/xlnx/zynqmp_disp.c:949:14: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses]
      949 |         if (WARN_ON(!layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE)) {
          |                     ^            ~~
    arch/s390/include/asm/bug.h:54:25: note: expanded from macro 'WARN_ON'
       54 |         int __ret_warn_on = !!(x);                      \
          |                                ^
    drivers/gpu/drm/xlnx/zynqmp_disp.c:949:14: note: add parentheses after the '!' to evaluate the comparison first
    drivers/gpu/drm/xlnx/zynqmp_disp.c:949:14: note: add parentheses around left hand side expression to silence this warning

which get promoted to errors in my test builds.  Adding the suggested
parens elides those warnings.

Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405080553.tfH9EmS8-lkp@intel.com/
Signed-off-by: Palmer Dabbelt <palmer at rivosinc.com>
---
I couldn't find a patch for this in Linus' tree or on the lists, sorry
if someone's already fixed it.  No rush on my end, I'll just stash this
in a local branch for the tester.
---
 drivers/gpu/drm/xlnx/zynqmp_disp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 13157da0089e..d37b4a9c99ea 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -981,7 +981,7 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer,
 	unsigned int i;
 	u32 *formats;
 
-	if (WARN_ON(!layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE)) {
+	if (WARN_ON((!layer->mode) == ZYNQMP_DPSUB_LAYER_NONLIVE)) {
 		*num_formats = 0;
 		return NULL;
 	}
-- 
2.45.0




More information about the linux-arm-kernel mailing list