Linux 6.9-rc1
[linux-2.6-microblaze.git] / drivers / gpu / drm / drm_probe_helper.c
index 4d60cc8..bf2dd1f 100644 (file)
@@ -422,6 +422,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.