mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 22:02:28 +00:00
drm/probe-helper: warn about negative .get_modes()
The .get_modes() callback is supposed to return the number of modes, never a negative error code. If a negative value is returned, it'll just be interpreted as a negative count, and added to previous calculations. Document the rules, but handle the negative values gracefully with an error message. Cc: stable@vger.kernel.org Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/50208c866facc33226a3c77b82bb96aeef8ef310.1709913674.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
parent
dea185b71b
commit
7af03e6887
@ -422,6 +422,13 @@ static int drm_helper_probe_get_modes(struct drm_connector *connector)
|
|||||||
|
|
||||||
count = connector_funcs->get_modes(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
|
* Fallback for when DDC probe failed in drm_get_edid() and thus skipped
|
||||||
* override/firmware EDID.
|
* override/firmware EDID.
|
||||||
|
@ -898,7 +898,8 @@ struct drm_connector_helper_funcs {
|
|||||||
*
|
*
|
||||||
* RETURNS:
|
* 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);
|
int (*get_modes)(struct drm_connector *connector);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user