diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-04-04 07:20:56 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-04-04 07:20:56 +0000 |
commit | 4fe11fc5ab1ff8bbd4e05b843e240fff2100c85e (patch) | |
tree | 1f0126178296643422567b52d31d7ef0dd81093a | |
parent | 29781e3d7bf49c44f014637c8ff6c8ebb3a3b29e (diff) |
drm/probe-helper: warn about negative .get_modes()
From Jani Nikula
12bbe2c25cdb571190d523fd814e7696964a84d9 in linux-6.6.y/6.6.24
7af03e688792293ba33149fb8df619a8dff90e80 in mainline linux
-rw-r--r-- | sys/dev/pci/drm/drm_probe_helper.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/drm/include/drm/drm_modeset_helper_vtables.h | 3 |
2 files changed, 9 insertions, 1 deletions
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); |