summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_atomic.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-11-19 18:38:06 +0100
committerDave Airlie <airlied@redhat.com>2014-11-20 02:35:18 +0100
commitc7eb76f4931b505e57c6510133df19f4ec1ce3e5 (patch)
treec9a21a82b2ca4ea1c97d6870e7bace2a3616d446 /drivers/gpu/drm/drm_atomic.c
parentdrm/irq: BUG_ON() -> WARN_ON() (diff)
downloadlinux-c7eb76f4931b505e57c6510133df19f4ec1ce3e5.tar.xz
linux-c7eb76f4931b505e57c6510133df19f4ec1ce3e5.zip
drm/atomic: Ensure that drm_connector_index is stable
I've totally forgotten that with DP MST connectors can now be hotplugged. And failed to adapt Rob's drm_atomic_state code (which predates connector hotplugging) to the new realities. The first step is to make sure that the connector indices used to access the arrays of pointers are stable. The connection mutex gives us enough guarantees for that, which means we won't unecessarily block on concurrent modesets or background probing. So add a locking WARN_ON and shuffle the code slightly to make sure we always hold the right lock. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_atomic.c')
-rw-r--r--drivers/gpu/drm/drm_atomic.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index ed22a719440f..90b2d1644bd7 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -295,15 +295,15 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
struct drm_mode_config *config = &connector->dev->mode_config;
struct drm_connector_state *connector_state;
+ ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
+ if (ret)
+ return ERR_PTR(ret);
+
index = drm_connector_index(connector);
if (state->connector_states[index])
return state->connector_states[index];
- ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
- if (ret)
- return ERR_PTR(ret);
-
connector_state = connector->funcs->atomic_duplicate_state(connector);
if (!connector_state)
return ERR_PTR(-ENOMEM);