diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2020-09-08 12:26:11 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-26 10:25:13 +0200 |
commit | 2d307380efec79ef7e1bd91ad4886fc02e2df26a (patch) | |
tree | 4a584b8a7cd9a037236b7f027942aa14afbd95c7 /drivers/media/cec | |
parent | 5254187cfaf22facc42415ad45c16db53ffd0c87 (diff) | |
download | linux-2d307380efec79ef7e1bd91ad4886fc02e2df26a.tar.bz2 |
media: cec-adap.c: add 'unregistered' checks
Make the code a bit more robust by checking if the adapter has
been unregistered at the start of cec_transmit_msg_fh() and
cec_received_msg_ts(). If it is unregistered, then just return.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/cec')
-rw-r--r-- | drivers/media/cec/core/cec-adap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index 80fd5165f658..3f016caa45ba 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -751,6 +751,9 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, struct cec_data *data; bool is_raw = msg_is_raw(msg); + if (adap->devnode.unregistered) + return -ENODEV; + msg->rx_ts = 0; msg->tx_ts = 0; msg->rx_status = 0; @@ -1049,6 +1052,9 @@ void cec_received_msg_ts(struct cec_adapter *adap, if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE)) return; + if (adap->devnode.unregistered) + return; + /* * Some CEC adapters will receive the messages that they transmitted. * This test filters out those messages by checking if we are the |