From: popcornmix Date: Fri, 15 Sep 2017 15:07:38 +0000 (+0100) Subject: tvservice: Avoid unmatched reference counting on attach/unplugged events X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66bb8d0f01ff7080cfd305edea29dca685c60f1c;p=platform%2Fadaptation%2Fbroadcom%2Flibomxil-vc4.git tvservice: Avoid unmatched reference counting on attach/unplugged events Thanks to Phil for spotting the suspicious code. See: https://github.com/raspberrypi/firmware/issues/875 --- diff --git a/interface/vmcs_host/vc_vchi_tvservice.c b/interface/vmcs_host/vc_vchi_tvservice.c index b8337f3..69832ad 100644 --- a/interface/vmcs_host/vc_vchi_tvservice.c +++ b/interface/vmcs_host/vc_vchi_tvservice.c @@ -693,6 +693,9 @@ static void *tvservice_notify_func(void *arg) { vchi_service_use(state->notify_handle[0]); } } + // the state machine below only wants a single bit to be set + if (tvstate.state & (VC_HDMI_ATTACHED|VC_HDMI_UNPLUGGED)) + tvstate.state &= ~(VC_HDMI_HDMI | VC_HDMI_DVI); while(1) { VCOS_STATUS_T status = vcos_event_wait(&tvservice_notify_available_event); @@ -718,7 +721,7 @@ static void *tvservice_notify_func(void *arg) { param1, param2); switch(reason) { case VC_HDMI_UNPLUGGED: - if(tvstate.state & (VC_HDMI_HDMI|VC_HDMI_DVI|VC_HDMI_ATTACHED)) { + if(tvstate.state & (VC_HDMI_HDMI|VC_HDMI_DVI)) { state->copy_protect = 0; if((tvstate.state & VC_HDMI_ATTACHED) == 0) { vchi_service_release(state->notify_handle[0]);