drm: gud: replace WARN_ON/WARN_ON_ONCE with drm versions
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ruben Wauters
maintainerPATCH 1/1 drm: gud: replace WARN_ON/WARN_ON_ONCE with drm versions
GUD is a drm driver, and therefore should use the drm versions of WARN_ON and WARN_ON_ONCE. This patch replaces all instances of WARN_ON and WARN_ON_ONCE with drm_WARN_ON and drm_WARN_ON_ONCE.
--- drivers/gpu/drm/gud/gud_connector.c | 8 ++++---- drivers/gpu/drm/gud/gud_pipe.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/gud/gud_connector.c +4 -4
@@ -561,11 +561,11 @@ static int gud_connector_add_properties(struct gud_device *gdrm, struct gud_conncontinue ;/* not a DRM property */ property =gud_connector_property_lookup (connector, prop); -if (WARN_ON (IS_ERR (property))) +if (drm_WARN_ON (drm,IS_ERR (property)))continue ; state_val =gud_connector_tv_state_val (prop, &gconn->initial_tv_state); -if (WARN_ON (IS_ERR (state_val))) +if (drm_WARN_ON (drm,IS_ERR (state_val)))continue ; *state_val = val;
@@ -593,7 +593,7 @@ int gud_connector_fill_properties(struct drm_connector_state *connector_state,unsigned int *state_val; state_val =gud_connector_tv_state_val (prop, &connector_state->tv); -if (WARN_ON_ONCE (IS_ERR (state_val))) +if (drm_WARN_ON_ONCE (connector_state->connector->dev, state_val))return PTR_ERR (state_val); val = *state_val;
@@ -667,7 +667,7 @@ static int gud_connector_create(struct gud_device *gdrm, unsigned int index,return ret; } -if (WARN_ON (connector->index != index)) +if (drm_WARN_ON (drm, connector->index != index))return -EINVAL ;if (flags &GUD_CONNECTOR_FLAGS_POLL_STATUS )
drivers/gpu/drm/gud/gud_pipe.c +5 -5
@@ -61,7 +61,7 @@ static size_t gud_xrgb8888_to_r124(u8 *dst, const struct drm_format_info *formatsize_t len;void *buf; -WARN_ON_ONCE (format->char_per_block[0 ] !=1 ); +drm_WARN_ON_ONCE (fb->dev, format->char_per_block[0 ] !=1 );/* Start on a byte boundary */ rect->x1 =ALIGN_DOWN (rect->x1, block_width);
@@ -138,7 +138,7 @@ static size_t gud_xrgb8888_to_color(u8 *dst, const struct drm_format_info *forma pix = ((r >>7 ) <<2 ) | ((g >>7 ) <<1 ) | (b >>7 );break ;default : -WARN_ON_ONCE (1 ); +drm_WARN_ON_ONCE (fb->dev,1 );return len; }
@@ -527,7 +527,7 @@ int gud_plane_atomic_check(struct drm_plane *plane,drm_connector_list_iter_end (&conn_iter); } -if (WARN_ON_ONCE (!connector_state)) +if (drm_WARN_ON_ONCE (plane->dev, !connector_state))return -ENOENT ; len = struct_size(req, properties,
@@ -539,7 +539,7 @@ int gud_plane_atomic_check(struct drm_plane *plane,gud_from_display_mode (&req->mode, mode); req->format =gud_from_fourcc (format->format); -if (WARN_ON_ONCE (!req->format)) { +if (drm_WARN_ON_ONCE (plane->dev, !req->format)) { ret = -EINVAL ; goto out; }
@@ -561,7 +561,7 @@ int gud_plane_atomic_check(struct drm_plane *plane, val = new_plane_state->rotation;break ;default : -WARN_ON_ONCE (1 ); +drm_WARN_ON_ONCE (plane->dev,1 ); ret = -EINVAL ; goto out; }
Signature · 1 line
2.49.1
Hi
Am 14.09.25 um 17:50 schrieb Ruben Wauters:
Quoted 5 lines
GUD is a drm driver, and therefore should use the drm versions of
WARN_ONandWARN_ON_ONCE. This patch replaces all instances ofWARN_ONandWARN_ON_ONCEwithdrm_WARN_ONanddrm_WARN_ON_ONCE.Signed-off-by Ruben Wauters <[email protected]>
Thanks a lot. I'll merge the patch in a bit.
Best regards
Thomas
Quoted 90 lines
--- drivers/gpu/drm/gud/gud_connector.c | 8 ++++---- drivers/gpu/drm/gud/gud_pipe.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-)drivers/gpu/drm/gud/gud_connector.c +4
-4@@ -561,11 +561,11 @@ static int gud_connector_add_properties(struct gud_device *gdrm, struct gud_conncontinue ;/* not a DRM property */ property =gud_connector_property_lookup (connector, prop); -if (WARN_ON (IS_ERR (property))) +if (drm_WARN_ON (drm,IS_ERR (property)))continue ; state_val =gud_connector_tv_state_val (prop, &gconn->initial_tv_state); -if (WARN_ON (IS_ERR (state_val))) +if (drm_WARN_ON (drm,IS_ERR (state_val)))continue ; *state_val = val;@@ -593,7 +593,7 @@ int gud_connector_fill_properties(struct drm_connector_state *connector_state,unsigned int *state_val; state_val =gud_connector_tv_state_val (prop, &connector_state->tv); -if (WARN_ON_ONCE (IS_ERR (state_val))) +if (drm_WARN_ON_ONCE (connector_state->connector->dev, state_val))return PTR_ERR (state_val); val = *state_val;@@ -667,7 +667,7 @@ static int gud_connector_create(struct gud_device *gdrm, unsigned int index,return ret; } -if (WARN_ON (connector->index != index)) +if (drm_WARN_ON (drm, connector->index != index))return -EINVAL ;if (flags &GUD_CONNECTOR_FLAGS_POLL_STATUS )drivers/gpu/drm/gud/gud_pipe.c +5
-5@@ -61,7 +61,7 @@ static size_t gud_xrgb8888_to_r124(u8 *dst, const struct drm_format_info *formatsize_t len;void *buf; -WARN_ON_ONCE (format->char_per_block[0 ] !=1 ); +drm_WARN_ON_ONCE (fb->dev, format->char_per_block[0 ] !=1 );/* Start on a byte boundary */ rect->x1 =ALIGN_DOWN (rect->x1, block_width);@@ -138,7 +138,7 @@ static size_t gud_xrgb8888_to_color(u8 *dst, const struct drm_format_info *forma pix = ((r >>7 ) <<2 ) | ((g >>7 ) <<1 ) | (b >>7 );break ;default : -WARN_ON_ONCE (1 ); +drm_WARN_ON_ONCE (fb->dev,1 );return len; }@@ -527,7 +527,7 @@ int gud_plane_atomic_check(struct drm_plane *plane,drm_connector_list_iter_end (&conn_iter); } -if (WARN_ON_ONCE (!connector_state)) +if (drm_WARN_ON_ONCE (plane->dev, !connector_state))return -ENOENT ; len = struct_size(req, properties,@@ -539,7 +539,7 @@ int gud_plane_atomic_check(struct drm_plane *plane,gud_from_display_mode (&req->mode, mode); req->format =gud_from_fourcc (format->format); -if (WARN_ON_ONCE (!req->format)) { +if (drm_WARN_ON_ONCE (plane->dev, !req->format)) { ret = -EINVAL ; goto out; }@@ -561,7 +561,7 @@ int gud_plane_atomic_check(struct drm_plane *plane, val = new_plane_state->rotation;break ;default : -WARN_ON_ONCE (1 ); +drm_WARN_ON_ONCE (plane->dev,1 ); ret = -EINVAL ; goto out; }
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Dan Carpenter
build botBCC: [email protected] CC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: Ruben Wauters…
BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Ruben Wauters <[email protected]>
TO: Maarten Lankhorst <[email protected]>
TO: Maxime Ripard <[email protected]>
TO: Thomas Zimmermann <[email protected]>
TO: David Airlie <[email protected]>
TO: Simona Vetter <[email protected]>
CC: Ruben Wauters <[email protected]>
CC: [email protected]
CC: [email protected]
Hi Ruben,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.17-rc6 next-20250919] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ruben-Wauters/drm-gud-replace-WARN_ON-WARN_ON_ONCE-with-drm-versions/20250914-235627 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20250914155308.2144-1-rubenru09%40aol.com patch subject: [PATCH] drm: gud: replace WARN_ON/WARN_ON_ONCE with drm versions
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: x86_64-randconfig-161-20250921 (https://download.01.org/0day-ci/archive/20250921/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/gpu/drm/gud/gud_connector.c:597 gud_connector_fill_properties() warn: passing a valid pointer to 'PTR_ERR'
vim +/PTR_ERR +597 drivers/gpu/drm/gud/gud_connector.c
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 579
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 580 int gud_connector_fill_properties(struct drm_connector_state *connector_state,
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 581 struct gud_property_req *properties)
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 582 {
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 583 struct gud_connector *gconn = to_gud_connector(connector_state->connector);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 584 unsigned int i;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 585
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 586 for (i = 0; i < gconn->num_properties; i++) {
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 587 u16 prop = gconn->properties[i];
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 588 u64 val;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 589
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 590 if (prop == GUD_PROPERTY_BACKLIGHT_BRIGHTNESS) {
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 591 val = connector_state->tv.brightness;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 592 } else {
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 593 unsigned int *state_val;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 594
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 595 state_val = gud_connector_tv_state_val(prop, &connector_state->tv);
d00e57106c0d0c Ruben Wauters 2025-09-14 596 if (drm_WARN_ON_ONCE(connector_state->connector->dev, state_val))
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 @597 return PTR_ERR(state_val);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 598
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 599 val = *state_val;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 600 }
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 601
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 602 properties[i].prop = cpu_to_le16(prop);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 603 properties[i].val = cpu_to_le64(val);
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 604 }
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 605
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 606 return gconn->num_properties;
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 607 }
40e1a70b4aedf2 Noralf Trønnes 2021-03-13 608 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Ruben Wauters
maintainerQuoted 6 lines · Dan Carpenter
Hi Ruben,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
Quoted 13 lines
url:
https://github.com/intel-lab-lkp/linux/commits/Ruben-Wauters/drm-gud-replace-WARN_ON-WARN_ON_ONCE-with-drm-versions/20250914-235627
base:git://anongit.freedesktop.org/drm/drm-miscdrm-misc-next patch link:
https://lore.kernel.org/r/20250914155308.2144-1-rubenru09%40aol.com
patch subject: [PATCH] drm: gud: replace WARN_ON/WARN_ON_ONCE with drm versions
config: x86_64-randconfig-161-20250921
(https://download.01.org/0day-ci/archive/20250921/202509212215.c8v3RK
[email protected]/config)
compiler: clang version 20.1.8
(https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
Hi,
Thank you for catching this, I completely missed it. Since the patch has already been applied to drm-misc-next I will send another patch to fix this issue.
Quoted 44 lines
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tagsQuoted 4 lines
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>smatch warnings:
drivers/gpu/drm/gud/gud_connector.c:597gud_connector_fill_properties()warn: passing a valid pointer to 'PTR_ERR'vim +/PTR_ERR +597
drivers/gpu/drm/gud/gud_connector.c
40e1a70b4aedf2Noralf Trønnes 2021-03-13 580 int gud_connector_fill_properties(structdrm_connector_state*connector_state,40e1a70b4aedf2Noralf Trønnes 2021-03-13
581 structgud_property_req*properties)40e1a70b4aedf2Noralf Trønnes 2021-03-13 582 {40e1a70b4aedf2Noralf Trønnes 2021-03-13 583 structgud_connector
*gconn =to_gud_connector(connector_state->connector);40e1a70b4aedf2Noralf Trønnes 2021-03-13 584 unsigned int i;40e1a70b4aedf2Noralf Trønnes 2021-03-13 58540e1a70b4aedf2Noralf Trønnes 2021-03-13 586 for (i = 0; i <gconn->num_properties; i++) {40e1a70b4aedf2Noralf Trønnes 2021-03-13 587 u16 prop =
gconn->properties[i];40e1a70b4aedf2Noralf Trønnes 2021-03-13 588 u64 val;40e1a70b4aedf2Noralf Trønnes 2021-03-13 58940e1a70b4aedf2Noralf Trønnes 2021-03-13 590 if (prop ==GUD_PROPERTY_BACKLIGHT_BRIGHTNESS) {40e1a70b4aedf2Noralf Trønnes 2021-03-13 591 val
=connector_state->tv.brightness;40e1a70b4aedf2Noralf Trønnes 2021-03-13 592 } else {40e1a70b4aedf2Noralf Trønnes 2021-03-13
593 unsigned int*state_val;40e1a70b4aedf2Noralf Trønnes 2021-03-13 59440e1a70b4aedf2Noralf Trønnes 2021-03-13
595state_val=gud_connector_tv_state_val(prop, &connector_state->tv);d00e57106c0d0cRuben Wauters 2025-09-14 596 if
(drm_WARN_ON_ONCE(connector_state->connector->dev, state_val))
Quoted 2 lines
You accidentally deleted the
IS_ERR()check so now this function is badly broken.
What I think happened was that on replacing WARN_ON_ONCE with drm_WARN_ON_ONCE I had to find a drm device for the first parameter. Since there was not one readily available I believe I ended up re- writing this line, and accidentally left out the IS_ERR(). I will fix this.
Quoted 17 lines
if (drm_WARN_ON_ONCE(connector_state->connector->dev,
IS_ERR(state_val)))
40e1a70b4aedf2Noralf Trønnes 2021-03-13
@597 returnPTR_ERR(state_val);40e1a70b4aedf2Noralf Trønnes 2021-03-13 59840e1a70b4aedf2Noralf Trønnes 2021-03-13 599 val
=*state_val;40e1a70b4aedf2Noralf Trønnes 2021-03-13 600 }40e1a70b4aedf2Noralf Trønnes 2021-03-13 60140e1a70b4aedf2Noralf Trønnes 2021-03-13
602 properties[i].prop =cpu_to_le16(prop);40e1a70b4aedf2Noralf Trønnes 2021-03-13
603 properties[i].val =cpu_to_le64(val);40e1a70b4aedf2Noralf Trønnes 2021-03-13 604 }40e1a70b4aedf2Noralf Trønnes 2021-03-13 60540e1a70b4aedf2Noralf Trønnes 2021-03-13 606 return gconn-
Quoted 2 lines
Quoted 1 line
num_properties;
40e1a70b4aedf2Noralf Trønnes 2021-03-13 607 }
Thank you for reporting this
Ruben Wauters