Merge tag 'drm-next-2024-03-22' of https://gitlab.freedesktop.org/drm/kernel
[linux-2.6-microblaze.git] / drivers / gpu / drm / drm_panel.c
index e814020..cfbe020 100644 (file)
@@ -274,19 +274,24 @@ EXPORT_SYMBOL(drm_panel_disable);
  * The modes probed from the panel are automatically added to the connector
  * that the panel is attached to.
  *
- * Return: The number of modes available from the panel on success or a
- * negative error code on failure.
+ * Return: The number of modes available from the panel on success, or 0 on
+ * failure (no modes).
  */
 int drm_panel_get_modes(struct drm_panel *panel,
                        struct drm_connector *connector)
 {
        if (!panel)
-               return -EINVAL;
+               return 0;
 
-       if (panel->funcs && panel->funcs->get_modes)
-               return panel->funcs->get_modes(panel, connector);
+       if (panel->funcs && panel->funcs->get_modes) {
+               int num;
 
-       return -EOPNOTSUPP;
+               num = panel->funcs->get_modes(panel, connector);
+               if (num > 0)
+                       return num;
+       }
+
+       return 0;
 }
 EXPORT_SYMBOL(drm_panel_get_modes);