From 1a719e0e2a49157f14eb8d77dc2620a2e9495f5c Mon Sep 17 00:00:00 2001 From: Algea Cao Date: Tue, 26 Dec 2017 15:49:08 +0800 Subject: [PATCH] UPSTREAM: media: cec: ensure that adap_enable(false) is called from cec_delete_adapter() When the adapter is removed the cec_delete_adapter() call attempts to set the physical address to INVALID by calling __cec_s_phys_addr() and so disabling the adapter. However, __cec_s_phys_addr checks if the device node was unregistered and just returns in that case. This means that the adap_enable callback is never called with 'false' to disable the CEC adapter. Most drivers don't care, but some need to do cleanup here. Change the test so the adapter is correctly disabled, even when the device node is unregistered. Signed-off-by: Hans Verkuil Reported-by: Tomi Valkeinen Signed-off-by: Mauro Carvalho Chehab (cherry picked from commit 152b0a9a3d62f90e6784a5d35ffc3f552f1c2c54) Change-Id: Ib440b172a524e8d7fd8282b26a7ab3123683b158 Signed-off-by: Algea Cao --- drivers/media/cec/cec-adap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index d9adeb505c09..d278494997cd 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c @@ -1448,7 +1448,9 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) */ void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) { - if (phys_addr == adap->phys_addr || adap->devnode.unregistered) + if (phys_addr == adap->phys_addr) + return; + if (phys_addr != CEC_PHYS_ADDR_INVALID && adap->devnode.unregistered) return; dprintk(1, "new physical address %x.%x.%x.%x\n",