diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2022-03-17 08:51:20 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-04-24 07:40:42 +0100 |
commit | e2ed5024ac2bc27d4bfc99fd58f5ab54de8fa965 (patch) | |
tree | cbf06cf9cdc0b39160ff83a0e4b48af9582989f4 /drivers/media/cec/core/cec-api.c | |
parent | 567f882a401346779d05a90beb8f21865ebdd398 (diff) | |
download | linux-e2ed5024ac2bc27d4bfc99fd58f5ab54de8fa965.tar.gz linux-e2ed5024ac2bc27d4bfc99fd58f5ab54de8fa965.tar.bz2 linux-e2ed5024ac2bc27d4bfc99fd58f5ab54de8fa965.zip |
media: cec: use call_op and check for !unregistered
Use call_(void_)op consistently in the CEC core framework. Ditto
for the cec pin ops. And check if !adap->devnode.unregistered before
calling each op. This avoids calls to ops when the device has been
unregistered and the underlying hardware may be gone.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/cec/core/cec-api.c')
-rw-r--r-- | drivers/media/cec/core/cec-api.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c index 0284db12842b..67dc79ef1705 100644 --- a/drivers/media/cec/core/cec-api.c +++ b/drivers/media/cec/core/cec-api.c @@ -595,7 +595,8 @@ static int cec_open(struct inode *inode, struct file *filp) adap->conn_info.type != CEC_CONNECTOR_TYPE_NO_CONNECTOR; cec_queue_event_fh(fh, &ev, 0); #ifdef CONFIG_CEC_PIN - if (adap->pin && adap->pin->ops->read_hpd) { + if (adap->pin && adap->pin->ops->read_hpd && + !adap->devnode.unregistered) { err = adap->pin->ops->read_hpd(adap); if (err >= 0) { ev.event = err ? CEC_EVENT_PIN_HPD_HIGH : @@ -603,7 +604,8 @@ static int cec_open(struct inode *inode, struct file *filp) cec_queue_event_fh(fh, &ev, 0); } } - if (adap->pin && adap->pin->ops->read_5v) { + if (adap->pin && adap->pin->ops->read_5v && + !adap->devnode.unregistered) { err = adap->pin->ops->read_5v(adap); if (err >= 0) { ev.event = err ? CEC_EVENT_PIN_5V_HIGH : |