Commit c000e5da authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cec: add check if adapter is unregistered

CEC USB dongles can be unplugged at any time, and at that point they will
be unregistered. Make sure that any attempt afterwards to set the physical
or logical addresses will be ignored.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 65898fb9
...@@ -1104,7 +1104,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block) ...@@ -1104,7 +1104,7 @@ 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) void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block)
{ {
if (phys_addr == adap->phys_addr) if (phys_addr == adap->phys_addr || adap->devnode.unregistered)
return; return;
if (phys_addr == CEC_PHYS_ADDR_INVALID || if (phys_addr == CEC_PHYS_ADDR_INVALID ||
...@@ -1158,6 +1158,9 @@ int __cec_s_log_addrs(struct cec_adapter *adap, ...@@ -1158,6 +1158,9 @@ int __cec_s_log_addrs(struct cec_adapter *adap,
u16 type_mask = 0; u16 type_mask = 0;
int i; int i;
if (adap->devnode.unregistered)
return -ENODEV;
if (!log_addrs || log_addrs->num_log_addrs == 0) { if (!log_addrs || log_addrs->num_log_addrs == 0) {
adap->log_addrs.num_log_addrs = 0; adap->log_addrs.num_log_addrs = 0;
cec_adap_unconfigure(adap); cec_adap_unconfigure(adap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment