On Fri, May 06, 2016 at 05:07:09PM +0300, Ville Syrjälä wrote: > On Fri, May 06, 2016 at 03:39:03PM +0200, Daniel Vetter wrote: > > This was forgotten when adding the the refcounting to > > drm_connector_state. > > > > v2: Don't forget to unreference existing connectors. This isn't > > relevant on driver load, but this code also runs on resume, and there > > we already have an atomic state. Spotted by Chris Wilson. > > > > Cc: Gabriel Feceoru <gabriel.feceoru@xxxxxxxxx> > > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > > Cc: Marius Vlad <marius.c.vlad@xxxxxxxxx> > > Cc: Dave Airlie <airlied@xxxxxxxxxx> > > Fixes: d2307dea14a4 ("drm/atomic: use connector references (v3)") > > Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx> > > --- > > drivers/gpu/drm/i915/intel_display.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > > index 45c218db86be..6ba676f81bae 100644 > > --- a/drivers/gpu/drm/i915/intel_display.c > > +++ b/drivers/gpu/drm/i915/intel_display.c > > @@ -12023,11 +12023,16 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev) > > struct intel_connector *connector; > > > > for_each_intel_connector(dev, connector) { > > + if (connector->base.state->crtc) > > + drm_connector_unreference(&connector->base); > > + > > if (connector->base.encoder) { > > connector->base.state->best_encoder = > > connector->base.encoder; > > connector->base.state->crtc = > > connector->base.encoder->crtc; > > + > > + drm_connector_reference(&connector->base); > > Is it safe to unref before ref? In this case, I believe we can assert that we hold a reference to the connector (as part of the driver state) and the atomic state holds a reference, i.e. the reference count here should be at least 2. If it was freed, we would get a warn from kref as well as memdebug (if enabled). -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx