Skip to contentSkip to conversation

drm: xlnx: zynqmp_disp: Fix WARN_ON build warning

PATCH In review Palmer Dabbelt 3 participants 5 messages May 21, 2024 – May 22, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: xlnx: zynqmp_disp: Fix WARN_ON build warning

From: Palmer Dabbelt <[email protected]>

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.

---
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(-)
drivers/gpu/drm/xlnx/zynqmp_disp.c +1 -1
index 13157da0089e..d37b4a9c99ea 100644
@@ -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;
 	}
Signature · 1 line
2.45.0
maintainer
#1 lore raw

Hi Palmer,

(CC'ing Anatoliy)

Thank you for the patch.

Quoted 13 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

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

Quoted 2 lines

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

I think this should have

Fixes b0f0469ab662 ("drm: xlnx: zynqmp_dpsub: Anounce supported input formats")
Quoted 16 lines

---
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(-)
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
index 13157da0089e..d37b4a9c99ea 100644

drivers/gpu/drm/xlnx/zynqmp_disp.c u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, · line 984

Quoted 5 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +1 -1
@@ -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)) {

That doesn't seem right. layer->mode isn't a boolean, it's an enum. The right fix seems to be

	if (WARN_ON(layer->mode != ZYNQMP_DPSUB_LAYER_NONLIVE)) {

Anatoliy, could you check this ? Palmer, do you plan to submit a new version of the patch, or should I send the right fix separately ?

Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
 		*num_formats = 0;
 		return NULL;
 	}
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#2 lore raw
Quoted 52 lines · Laurent Pinchart

Hi Palmer,

(CC'ing Anatoliy)

Thank you for the patch.

Quoted 13 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

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

Quoted 2 lines

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

I think this should have

Fixes b0f0469ab662 ("drm: xlnx: zynqmp_dpsub: Anounce supported input formats")
Quoted 16 lines

---
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(-)
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
index 13157da0089e..d37b4a9c99ea 100644

drivers/gpu/drm/xlnx/zynqmp_disp.c u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, · line 984

Quoted 5 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +1 -1
@@ -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)) {

That doesn't seem right. layer->mode isn't a boolean, it's an enum. The right fix seems to be

Quoted 4 lines
	if (WARN_ON(layer->mode != ZYNQMP_DPSUB_LAYER_NONLIVE)) {

Anatoliy, could you check this ? Palmer, do you plan to submit a new version of the patch, or should I send the right fix separately ?

I see a fix is already present in the drm-misc-fixes branch. Please ignore my previous e-mail.

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
 		*num_formats = 0;
 		return NULL;
 	}
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#3 lore raw
Quoted 53 lines · Laurent Pinchart
Quoted 52 lines · Laurent Pinchart

Hi Palmer,

(CC'ing Anatoliy)

Thank you for the patch.

Quoted 13 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

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

Quoted 2 lines

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

I think this should have

Fixes b0f0469ab662 ("drm: xlnx: zynqmp_dpsub: Anounce supported input formats")
Quoted 16 lines

---
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(-)
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
index 13157da0089e..d37b4a9c99ea 100644

drivers/gpu/drm/xlnx/zynqmp_disp.c u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, · line 984

Quoted 5 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +1 -1
@@ -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)) {

That doesn't seem right. layer->mode isn't a boolean, it's an enum. The right fix seems to be

Quoted 7 lines
Quoted 4 lines
	if (WARN_ON(layer->mode != ZYNQMP_DPSUB_LAYER_NONLIVE)) {

Anatoliy, could you check this ? Palmer, do you plan to submit a new version of the patch, or should I send the right fix separately ?

I see a fix is already present in the drm-misc-fixes branch. Please ignore my previous e-mail.

I meant drm-misc-next-fixes.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
 		*num_formats = 0;
 		return NULL;
 	}
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw
In reply to Laurent Pinchart

Hi Laurent and Palmer,

Quoted 74 lines

-----Original Message-----
From: Laurent Pinchart <[email protected]>
Sent: Wednesday, May 22, 2024 7:44 AM
To: Palmer Dabbelt <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]; kernel test robot <[email protected]>; Klymenko, Anatoliy <[email protected]>
Subject: Re: [PATCH] drm: xlnx: zynqmp_disp: Fix WARN_ON build warning

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Hi Palmer,

(CC'ing Anatoliy)

Thank you for the patch.

Quoted 5 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

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]

Quoted 1 line
      949 |         if (WARN_ON(!layer->mode ==

ZYNQMP_DPSUB_LAYER_NONLIVE)) {

Quoted 2 lines

| ^ ~~
arch/s390/include/asm/bug.h:54:25: note: expanded from macro

'WARN_ON'

Quoted 3 lines

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

Quoted 1 line

drivers/gpu/drm/xlnx/zynqmp_disp.c:949:14: note: add parentheses

around left hand side expression to silence this warning

Quoted 3 lines

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

I think this should have

Fixes b0f0469ab662 ("drm: xlnx: zynqmp_dpsub: Anounce supported

input formats")

Quoted 2 lines

[email protected]/

Review

Quoted 10 lines

---
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(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/xlnx/zynqmp_disp.c

drivers/gpu/drm/xlnx/zynqmp_disp.c u32 *zynqmp_disp_layer_drm_formats(struct

Quoted 4 lines

index 13157da0089e..d37b4a9c99ea 100644

drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
@@ -981,7 +981,7 @@ u32 *zynqmp_disp_layer_drm_formats(struct

zynqmp_disp_layer *layer,

Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
      unsigned int i;
      u32 *formats;
 
Quoted 9 lines

drivers/gpu/drm/xlnx/zynqmp_disp.c u32 *zynqmp_disp_layer_drm_formats(struct · line 984

Quoted 2 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +1 -1
-     if (WARN_ON(!layer->mode == ZYNQMP_DPSUB_LAYER_NONLIVE)) {
+     if (WARN_ON((!layer->mode) == ZYNQMP_DPSUB_LAYER_NONLIVE))

{

That doesn't seem right. layer->mode isn't a boolean, it's an enum. The right fix seems to be

        if (WARN_ON(layer->mode != ZYNQMP_DPSUB_LAYER_NONLIVE)) {

Yes, this is how it should be.

Quoted 3 lines

Anatoliy, could you check this ? Palmer, do you plan to submit a new version of the patch, or should I send the right fix separately ?

Actually, this has been fixed here:
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=c72211751870ffa2cff5d91834059456cfa7cbd5.
Looks like the fix just missed the merge window.

Quoted 8 lines

drivers/gpu/drm/xlnx/zynqmp_disp.c u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, · line 987

Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +0 -0
              *num_formats = 0;
              return NULL;
      }

--
Regards,

Laurent Pinchart

--
Thank you,
Anatoliy