GPU: drm: meson inline drm_simple_encoder_init()
PATCH 1/1 GPU: drm: meson inline drm_simple_encoder_init()
Inline the call to drm_simple_encoder_init() for meson, as per the TODO list on docs.kernel.org/gpu/todo.html
--- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 -2
@@ -407,8 +407,8 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv) meson_encoder_hdmi->priv = priv;/* Encoder */ - ret =drm_simple_encoder_init (priv->drm, &meson_encoder_hdmi->encoder, -DRM_MODE_ENCODER_TMDS ); + ret =drm_encoder_init (priv->drm, &meson_encoder_hdmi->encoder, +DRM_MODE_ENCODER_TMDS ,NULL );if (ret) {dev_err_probe (priv->dev, ret,"Failed to init HDMI encoder\n" ); goto err_put_node;
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] Incorrect inlining of drm_simple_encoder_init() omits the funcs parameter, passing 4 arguments to a function expecting at least 5, resulting in a severe type mismatch and a missing drm_encoder_funcs structure.
Pre-existing issues:
- [High] Failure to remove the DRM bridge on error paths leaves a dangling pointer in the global bridge list and permanently leaks the bridge container memory. --
commit cff971d423a1058d9ded86a03517245fb14f47c1
Author: Liam Zuiderhoek <[email protected]>
GPU: drm: meson inline drm_simple_encoder_init()
This patch replaces the drm_simple_encoder_init() call in the meson HDMI encoder with a direct call to drm_encoder_init() as part of the DRM subsystem TODO list.
drivers/gpu/drm/meson/meson_encoder_hdmi.c int meson_encoder_hdmi_probe(struct meson_drm *priv) · line 411
Quoted 12 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +2
-2@@ -407,8 +407,8 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv) meson_encoder_hdmi->priv = priv;/* Encoder */ - ret =drm_simple_encoder_init (priv->drm, &meson_encoder_hdmi->encoder, -DRM_MODE_ENCODER_TMDS ); + ret =drm_encoder_init (priv->drm, &meson_encoder_hdmi->encoder, +DRM_MODE_ENCODER_TMDS ,NULL );
[Severity: High]
Does this pass the correct number of arguments to drm_encoder_init()?
Looking at drm_encoder_init() in drm_encoder.c, it expects at least five arguments:drm_encoder_init(dev, encoder, funcs, encoder_type, name, ...)
With only four arguments provided here in meson_encoder_hdmi_probe(), this appears to pass the integer DRM_MODE_ENCODER_TMDS into the const struct drm_encoder_funcs *funcs parameter, and NULL into the encoder_type parameter, omitting the name parameter entirely.
Will this cause a build failure, or a panic when funcs->destroy is later dereferenced?
drivers/gpu/drm/meson/meson_encoder_hdmi.c int meson_encoder_hdmi_probe(struct meson_drm *priv) · line 414
Quoted 3 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +0
-0if (ret) {dev_err_probe (priv->dev, ret,"Failed to init HDMI encoder\n" ); goto err_put_node;
[Severity: High]
This isn't a bug introduced by this patch, but does this error path need to call drm_bridge_remove() to prevent a memory leak?
Earlier in meson_encoder_hdmi_probe(), the bridge is added to the global bridge list:
drm_bridge_add(&meson_encoder_hdmi->bridge);
If drm_encoder_init() fails and takes this goto err_put_node path, the bridge remains in the global bridge list with an elevated refcount because drm_bridge_remove() is not called.
Could this leave an orphaned bridge that permanently breaks the display pipeline on subsequent probe retries?
Quoted 1 line
}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Liam,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on daeinki-drm-exynos/exynos-drm-next drm/drm-next drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-tip/drm-tip linus/master v7.2-rc7 next-20260811] [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/Liam-Zuiderhoek/GPU-drm-meson-inline-drm_simple_encoder_init/20260813-051125 base: https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next patch link: https://lore.kernel.org/r/20260622180832.28143-1-zuiderhoekl%40gmail.com patch subject: [PATCH] GPU: drm: meson inline drm_simple_encoder_init() config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20260813/[email protected]/config) compiler: powerpc64-linux-gcc (GCC) 16.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260813/[email protected]/reproduce)
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]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from include/drm/drm_property.h:30,
from include/drm/drm_connector.h:33,
from include/drm/drm_modes.h:33,
from include/drm/drm_crtc.h:32,
from include/drm/drm_atomic_helper.h:31,
from drivers/gpu/drm/meson/meson_encoder_hdmi.c:21:
drivers/gpu/drm/meson/meson_encoder_hdmi.c: In function 'meson_encoder_hdmi_probe':
>> include/uapi/drm/drm_mode.h:358:33: error: passing argument 3 of 'drm_encoder_init' makes pointer from integer without a cast [-Wint-conversion]
358 | #define DRM_MODE_ENCODER_TMDS 2
| ^
| |
| int
drivers/gpu/drm/meson/meson_encoder_hdmi.c:411:32: note: in expansion of macro 'DRM_MODE_ENCODER_TMDS'
411 | DRM_MODE_ENCODER_TMDS, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
In file included from include/drm/drm_modeset_helper_vtables.h:33,
from include/drm/drm_atomic_helper.h:32:
include/drm/drm_encoder.h:212:54: note: expected 'const struct drm_encoder_funcs *' but argument is of type 'int'
212 | const struct drm_encoder_funcs *funcs,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14,
from include/linux/types.h:5,
from include/linux/kasan-checks.h:5,
from include/asm-generic/rwonce.h:26,
from ./arch/powerpc/include/generated/asm/rwonce.h:1,
from include/linux/compiler.h:369,
from include/linux/err.h:5,
from include/linux/clk.h:12,
from drivers/gpu/drm/meson/meson_encoder_hdmi.c:8:
>> include/linux/stddef.h:8:14: error: passing argument 4 of 'drm_encoder_init' makes integer from pointer without a cast [-Wint-conversion]
8 | #define NULL ((void *)0)
| ^~~~~~~~~~~
| |
| void *
drivers/gpu/drm/meson/meson_encoder_hdmi.c:411:55: note: in expansion of macro 'NULL'
411 | DRM_MODE_ENCODER_TMDS, NULL);
| ^~~~
include/drm/drm_encoder.h:213:26: note: expected 'int' but argument is of type 'void *'
213 | int encoder_type, const char *name, ...);
| ~~~~^~~~~~~~~~~~
>> drivers/gpu/drm/meson/meson_encoder_hdmi.c:410:15: error: too few arguments to function 'drm_encoder_init'; expected at least 5, have 4
410 | ret = drm_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
| ^~~~~~~~~~~~~~~~ include/drm/drm_encoder.h:210:5: note: declared here
210 | int drm_encoder_init(struct drm_device *dev,
| ^~~~~~~~~~~~~~~~
--
In file included from include/drm/drm_property.h:30,
from include/drm/drm_connector.h:33,
from include/drm/drm_modes.h:33,
from include/drm/drm_crtc.h:32,
from include/drm/drm_atomic_helper.h:31,
from drm/meson/meson_encoder_hdmi.c:21:
drm/meson/meson_encoder_hdmi.c: In function 'meson_encoder_hdmi_probe':
>> include/uapi/drm/drm_mode.h:358:33: error: passing argument 3 of 'drm_encoder_init' makes pointer from integer without a cast [-Wint-conversion]
358 | #define DRM_MODE_ENCODER_TMDS 2
| ^
| |
| int
drm/meson/meson_encoder_hdmi.c:411:32: note: in expansion of macro 'DRM_MODE_ENCODER_TMDS'
411 | DRM_MODE_ENCODER_TMDS, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
In file included from include/drm/drm_modeset_helper_vtables.h:33,
from include/drm/drm_atomic_helper.h:32:
include/drm/drm_encoder.h:212:54: note: expected 'const struct drm_encoder_funcs *' but argument is of type 'int'
212 | const struct drm_encoder_funcs *funcs,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14,
from include/linux/types.h:5,
from include/linux/kasan-checks.h:5,
from include/asm-generic/rwonce.h:26,
from arch/powerpc/include/generated/asm/rwonce.h:1,
from include/linux/compiler.h:369,
from include/linux/err.h:5,
from include/linux/clk.h:12,
from drm/meson/meson_encoder_hdmi.c:8:
>> include/linux/stddef.h:8:14: error: passing argument 4 of 'drm_encoder_init' makes integer from pointer without a cast [-Wint-conversion]
8 | #define NULL ((void *)0)
| ^~~~~~~~~~~
| |
| void *
drm/meson/meson_encoder_hdmi.c:411:55: note: in expansion of macro 'NULL'
411 | DRM_MODE_ENCODER_TMDS, NULL);
| ^~~~
include/drm/drm_encoder.h:213:26: note: expected 'int' but argument is of type 'void *'
213 | int encoder_type, const char *name, ...);
| ~~~~^~~~~~~~~~~~
drm/meson/meson_encoder_hdmi.c:410:15: error: too few arguments to function 'drm_encoder_init'; expected at least 5, have 4
410 | ret = drm_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
| ^~~~~~~~~~~~~~~~ include/drm/drm_encoder.h:210:5: note: declared here
210 | int drm_encoder_init(struct drm_device *dev,
| ^~~~~~~~~~~~~~~~
vim +/drm_encoder_init +358 include/uapi/drm/drm_mode.h
8cf5c917715153 include/drm/drm_mode.h Jesse Barnes 2011-11-14 355 f453ba0460742a include/drm/drm_mode.h Dave Airlie 2008-11-07 356 #define DRM_MODE_ENCODER_NONE 0 f453ba0460742a include/drm/drm_mode.h Dave Airlie 2008-11-07 357 #define DRM_MODE_ENCODER_DAC 1 f453ba0460742a include/drm/drm_mode.h Dave Airlie 2008-11-07 @358 #define DRM_MODE_ENCODER_TMDS 2 f453ba0460742a include/drm/drm_mode.h Dave Airlie 2008-11-07 359 #define DRM_MODE_ENCODER_LVDS 3 f453ba0460742a include/drm/drm_mode.h Dave Airlie 2008-11-07 360 #define DRM_MODE_ENCODER_TVDAC 4 a7331e5cb2cc68 include/drm/drm_mode.h Thomas Hellstrom 2011-10-22 361 #define DRM_MODE_ENCODER_VIRTUAL 5 b89232732f642b include/uapi/drm/drm_mode.h Shobhit Kumar 2013-08-27 362 #define DRM_MODE_ENCODER_DSI 6 182407a6ed5333 include/uapi/drm/drm_mode.h Dave Airlie 2014-05-02 363 #define DRM_MODE_ENCODER_DPMST 7 0b27c02a7f1c69 include/uapi/drm/drm_mode.h Eric Anholt 2016-03-18 364 #define DRM_MODE_ENCODER_DPI 8 f453ba0460742a include/drm/drm_mode.h Dave Airlie 2008-11-07 365
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki