summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/omap_fb.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-12-24 15:58:01 +0400
committerRob Clark <robdclark@gmail.com>2014-03-31 19:06:51 +0400
commit06fb220b2d1a80be5621fa06ef276a3890e6be78 (patch)
treed4463a5bd48f4e59565f327eb19edf819e59daab /drivers/gpu/drm/omapdrm/omap_fb.c
parent30b6f8f6792abe582ef25100984a113ac9bc88dd (diff)
downloadlinux-06fb220b2d1a80be5621fa06ef276a3890e6be78.tar.xz
drm/omap: Don't dereference list head when the connectors list is empty
The connectors list iterator returns the list head when the list is empty. Fix it by returning NULL in that case. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_fb.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index f466c4aaee94..19a9b8613620 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -306,7 +306,8 @@ struct drm_connector *omap_framebuffer_get_next_connector(
struct drm_connector *connector = from;
if (!from)
- return list_first_entry(connector_list, typeof(*from), head);
+ return list_first_entry_or_null(connector_list, typeof(*from),
+ head);
list_for_each_entry_from(connector, connector_list, head) {
if (connector != from) {