From: Dan Carpenter <dan.carpenter@linaro.org>
To: Tang Bin <tangbin@cmss.chinamobile.com>,
Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
Cc: Vikash Garodia <quic_vgarodia@quicinc.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: [PATCH] Revert "venus: pm_helpers: Fix error check in vcodec_domains_get()"
Date: Mon, 3 Jul 2023 18:30:52 +0300 [thread overview]
Message-ID: <e1e46cfd-8d95-4792-ac8f-1237d2af7171@moroto.mountain> (raw)
This reverts commit 0f6e8d8c94a82e85e1b9b62a7671990740dc6f70.
The reverted commit was based on static analysis and a misunderstanding
of how PTR_ERR() and NULLs are supposed to work. When a function
returns both pointer errors and NULL then normally the NULL means
"continue operating without a feature because it was deliberately
turned off". The NULL should not be treated as a failure. If a driver
cannot work when that feature is disabled then the KConfig should
enforce that the function cannot return NULL. We should not need to
test for it.
In this code, the patch breaks the venus driver if CONFIG_PM is
disabled.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
This patch is also based on static analysis and review so probably best
to be cautious. My guess is that very few people disable CONFIG_PM
these days so that's why the bug wasn't caught.
drivers/media/platform/qcom/venus/pm_helpers.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index 48c9084bb4db..c93d2906e4c7 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -869,8 +869,8 @@ static int vcodec_domains_get(struct venus_core *core)
for (i = 0; i < res->vcodec_pmdomains_num; i++) {
pd = dev_pm_domain_attach_by_name(dev,
res->vcodec_pmdomains[i]);
- if (IS_ERR_OR_NULL(pd))
- return PTR_ERR(pd) ? : -ENODATA;
+ if (IS_ERR(pd))
+ return PTR_ERR(pd);
core->pmdomains[i] = pd;
}
--
2.39.2
next reply other threads:[~2023-07-03 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 15:30 Dan Carpenter [this message]
2023-07-10 7:29 ` [PATCH] Revert "venus: pm_helpers: Fix error check in vcodec_domains_get()" Vikash Garodia
2023-07-10 8:03 ` Dan Carpenter
2023-07-10 8:18 ` Vikash Garodia
2023-07-10 8:30 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e1e46cfd-8d95-4792-ac8f-1237d2af7171@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=quic_vgarodia@quicinc.com \
--cc=stanimir.k.varbanov@gmail.com \
--cc=tangbin@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox