summaryrefslogtreecommitdiff
path: root/drivers/staging/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-07-10 10:11:17 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-12 13:38:16 -0300
commitc000e5dad17d20c644bbf3ead52c334025d11ada (patch)
tree2bac0b609d6260e786cab8a4f132fe0733eccc03 /drivers/staging/media
parent65898fb99cd7629683d7759d0c0242b8280413fc (diff)
[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: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/staging/media')
-rw-r--r--drivers/staging/media/cec/cec-adap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c
index 7df61870473c..2cd656bd5272 100644
--- a/drivers/staging/media/cec/cec-adap.c
+++ b/drivers/staging/media/cec/cec-adap.c
@@ -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)
{
- if (phys_addr == adap->phys_addr)
+ if (phys_addr == adap->phys_addr || adap->devnode.unregistered)
return;
if (phys_addr == CEC_PHYS_ADDR_INVALID ||
@@ -1158,6 +1158,9 @@ int __cec_s_log_addrs(struct cec_adapter *adap,
u16 type_mask = 0;
int i;
+ if (adap->devnode.unregistered)
+ return -ENODEV;
+
if (!log_addrs || log_addrs->num_log_addrs == 0) {
adap->log_addrs.num_log_addrs = 0;
cec_adap_unconfigure(adap);