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>
This commit is contained in:
Laurent Pinchart 2013-12-24 12:58:01 +01:00 committed by Rob Clark
parent 30b6f8f679
commit 06fb220b2d
1 changed files with 2 additions and 1 deletions

View File

@ -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) {