提交 498946cf 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

media: cec-adap.c: don't unconfigure if already unconfigured

The __cec_s_log_addrs() function can configure or unconfigure the
adapter. The ioctl handler in cec-api.c will prevent it from being
called to configure the adapter if it was already configured (or in
the process of configuring). But it can still be called to unconfigure
an already unconfigured adapter, and it didn't check for that.

This can cause cec_activate_cnt_dec() to be called too often, causing
a WARN_ON.

Instead first check if adap->log_addrs.num_log_addrs == 0 and return
since in that case the adapter is already unconfigured.
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@kernel.org>
上级 5f4eb167
...@@ -1709,8 +1709,9 @@ int __cec_s_log_addrs(struct cec_adapter *adap, ...@@ -1709,8 +1709,9 @@ int __cec_s_log_addrs(struct cec_adapter *adap,
return -ENODEV; return -ENODEV;
if (!log_addrs || log_addrs->num_log_addrs == 0) { if (!log_addrs || log_addrs->num_log_addrs == 0) {
if (!adap->is_configuring && !adap->is_configured) if (!adap->log_addrs.num_log_addrs)
return 0; return 0;
if (adap->is_configuring || adap->is_configured)
cec_adap_unconfigure(adap); cec_adap_unconfigure(adap);
adap->log_addrs.num_log_addrs = 0; adap->log_addrs.num_log_addrs = 0;
for (i = 0; i < CEC_MAX_LOG_ADDRS; i++) for (i = 0; i < CEC_MAX_LOG_ADDRS; i++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册