mbox series

[0/8] drm: fix .get_modes() return values

Message ID cover.1709913674.git.jani.nikula@intel.com (mailing list archive)
Headers show
Series drm: fix .get_modes() return values | expand

Message

Jani Nikula March 8, 2024, 4:03 p.m. UTC
The drm_connector_helper_funcs .get_modes() hooks are not supposed to
return negative error codes. Some do, but they're not checked, and could
lead to mysterious errors. Fix this all over the place.

BR,
Jani.

Jani Nikula (8):
  drm/probe-helper: warn about negative .get_modes()
  drm/panel: do not return negative error codes from
    drm_panel_get_modes()
  drm/exynos: do not return negative values from .get_modes()
  drm/bridge: lt8912b: do not return negative values from .get_modes()
  drm/imx/ipuv3: do not return negative values from .get_modes()
  drm/vc4: hdmi: do not return negative values from .get_modes()
  drm/bridge: lt9611uxc: use int for holding number of modes
  drm/exynos: simplify the return value handling in
    exynos_dp_get_modes()

 drivers/gpu/drm/bridge/lontium-lt8912b.c     | 16 +++++++---------
 drivers/gpu/drm/bridge/lontium-lt9611uxc.c   |  2 +-
 drivers/gpu/drm/drm_panel.c                  | 17 +++++++++++------
 drivers/gpu/drm/drm_probe_helper.c           |  7 +++++++
 drivers/gpu/drm/exynos/exynos_dp.c           |  7 +++----
 drivers/gpu/drm/exynos/exynos_drm_vidi.c     |  4 ++--
 drivers/gpu/drm/exynos/exynos_hdmi.c         |  4 ++--
 drivers/gpu/drm/imx/ipuv3/parallel-display.c |  4 ++--
 drivers/gpu/drm/vc4/vc4_hdmi.c               |  2 +-
 include/drm/drm_modeset_helper_vtables.h     |  3 ++-
 10 files changed, 38 insertions(+), 28 deletions(-)

Comments

Thomas Zimmermann March 8, 2024, 4:24 p.m. UTC | #1
Hi

Am 08.03.24 um 17:03 schrieb Jani Nikula:
> The drm_connector_helper_funcs .get_modes() hooks are not supposed to
> return negative error codes. Some do, but they're not checked, and could
> lead to mysterious errors. Fix this all over the place.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

for the series.

Do you plan to make the return type an unsigned int eventually?

Best regards
Thomas

>
> BR,
> Jani.
>
> Jani Nikula (8):
>    drm/probe-helper: warn about negative .get_modes()
>    drm/panel: do not return negative error codes from
>      drm_panel_get_modes()
>    drm/exynos: do not return negative values from .get_modes()
>    drm/bridge: lt8912b: do not return negative values from .get_modes()
>    drm/imx/ipuv3: do not return negative values from .get_modes()
>    drm/vc4: hdmi: do not return negative values from .get_modes()
>    drm/bridge: lt9611uxc: use int for holding number of modes
>    drm/exynos: simplify the return value handling in
>      exynos_dp_get_modes()
>
>   drivers/gpu/drm/bridge/lontium-lt8912b.c     | 16 +++++++---------
>   drivers/gpu/drm/bridge/lontium-lt9611uxc.c   |  2 +-
>   drivers/gpu/drm/drm_panel.c                  | 17 +++++++++++------
>   drivers/gpu/drm/drm_probe_helper.c           |  7 +++++++
>   drivers/gpu/drm/exynos/exynos_dp.c           |  7 +++----
>   drivers/gpu/drm/exynos/exynos_drm_vidi.c     |  4 ++--
>   drivers/gpu/drm/exynos/exynos_hdmi.c         |  4 ++--
>   drivers/gpu/drm/imx/ipuv3/parallel-display.c |  4 ++--
>   drivers/gpu/drm/vc4/vc4_hdmi.c               |  2 +-
>   include/drm/drm_modeset_helper_vtables.h     |  3 ++-
>   10 files changed, 38 insertions(+), 28 deletions(-)
>
Jani Nikula March 13, 2024, 11:47 a.m. UTC | #2
On Fri, 08 Mar 2024, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> for the series.

Thanks, pushed the lot to drm-misc-next-fixes.

> Do you plan to make the return type an unsigned int eventually?

Not really. The hooks could still return -ENOMEM or something, with no
compiler warnings, and you'd be screwed because you wouldn't even have a
way of checking. You'd just get 4294967284 modes.


BR,
Jani.