From: jsg Date: Thu, 4 Apr 2024 07:20:55 +0000 (+0000) Subject: drm/probe-helper: warn about negative .get_modes() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9801e47d4248d711f1b973c18b7ab8323ea414e3;p=openbsd drm/probe-helper: warn about negative .get_modes() From Jani Nikula 12bbe2c25cdb571190d523fd814e7696964a84d9 in linux-6.6.y/6.6.24 7af03e688792293ba33149fb8df619a8dff90e80 in mainline linux --- diff --git a/sys/dev/pci/drm/drm_probe_helper.c b/sys/dev/pci/drm/drm_probe_helper.c index e5ccdc8f29b..169df0488e6 100644 --- a/sys/dev/pci/drm/drm_probe_helper.c +++ b/sys/dev/pci/drm/drm_probe_helper.c @@ -419,6 +419,13 @@ static int drm_helper_probe_get_modes(struct drm_connector *connector) count = connector_funcs->get_modes(connector); + /* The .get_modes() callback should not return negative values. */ + if (count < 0) { + drm_err(connector->dev, ".get_modes() returned %pe\n", + ERR_PTR(count)); + count = 0; + } + /* * Fallback for when DDC probe failed in drm_get_edid() and thus skipped * override/firmware EDID. diff --git a/sys/dev/pci/drm/include/drm/drm_modeset_helper_vtables.h b/sys/dev/pci/drm/include/drm/drm_modeset_helper_vtables.h index e3c3ac61590..159213786e6 100644 --- a/sys/dev/pci/drm/include/drm/drm_modeset_helper_vtables.h +++ b/sys/dev/pci/drm/include/drm/drm_modeset_helper_vtables.h @@ -898,7 +898,8 @@ struct drm_connector_helper_funcs { * * RETURNS: * - * The number of modes added by calling drm_mode_probed_add(). + * The number of modes added by calling drm_mode_probed_add(). Return 0 + * on failures (no modes) instead of negative error codes. */ int (*get_modes)(struct drm_connector *connector);