drm: mode: Allow NULL modes for equality check
authorDaniel Stone <daniels@collabora.com>
Thu, 19 Mar 2015 04:33:02 +0000 (04:33 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 23 Mar 2015 15:22:30 +0000 (16:22 +0100)
Since we're now using mode == NULL to represent disabled, it's not
wholly surprising that we'd want to compare NULL modes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_modes.c

index 53885968bdaf909a94129f5f7f946733edb4a69b..213b11ea69b5b7ecc6309cdbde007d46e0319144 100644 (file)
@@ -903,6 +903,12 @@ EXPORT_SYMBOL(drm_mode_duplicate);
  */
 bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2)
 {
+       if (!mode1 && !mode2)
+               return true;
+
+       if (!mode1 || !mode2)
+               return false;
+
        /* do clock check convert to PICOS so fb modes get matched
         * the same */
        if (mode1->clock && mode2->clock) {