From: Gabor Juhos <j4g8y7@gmail.com>
To: Konrad Dybcio <konrad.dybcio@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Sibi Sankar <quic_sibis@quicinc.com>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] firmware: qcom_scm: disable clocks if qcom_scm_bw_enable() fails
Date: Wed, 6 Mar 2024 19:03:06 +0100 [thread overview]
Message-ID: <f28633b9-cad8-4e1f-807c-830ba9368eb5@gmail.com> (raw)
In-Reply-To: <2fdb87f5-3702-44d9-9ebe-974c4a53a77d@linaro.org>
2024. 03. 06. 17:02 keltezéssel, Konrad Dybcio írta:
>
>
> On 3/6/24 05:10, Elliot Berman wrote:
>> On Tue, Mar 05, 2024 at 10:15:19PM +0100, Konrad Dybcio wrote:
>>>
>>>
>>> On 3/4/24 14:14, Gabor Juhos wrote:
>>>> There are several functions which are calling qcom_scm_bw_enable()
>>>> then returns immediately if the call fails and leaves the clocks
>>>> enabled.
>>>>
>>>> Change the code of these functions to disable clocks when the
>>>> qcom_scm_bw_enable() call fails. This also fixes a possible dma
>>>> buffer leak in the qcom_scm_pas_init_image() function.
>>>>
>>>> Compile tested only due to lack of hardware with interconnect
>>>> support.
>>>>
>>>> Cc: stable@vger.kernel.org
>>>> Fixes: 65b7ebda5028 ("firmware: qcom_scm: Add bw voting support to the SCM
>>>> interface")
>>>> Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
>>>> ---
>>>
>>> Taking a closer look, is there any argument against simply
>>> putting the clk/bw en/dis calls in qcom_scm_call()?
>>
>> We shouldn't do this because the clk/bw en/dis calls are only needed in
>> few SCM calls.
>
> Then the argument list could be expanded with `bool require_resources`,
> or so still saving us a lot of boilerplate
That would mean that we have to modify each callers of qcom_scm_call() to pass a
new parameter. Additionally, there are cases, when the bw enable part is not
needed so we should add separate parameters, one for clk and one for bw or we
should use a bitmask.
Would not it be simpler to use a helper function like the following instead?
static int qcom_scm_call_clk_bw(struct device *dev,
const struct qcom_scm_desc *desc,
struct qcom_scm_res *res)
{
int ret;
ret = qcom_scm_clk_enable();
if (ret)
return ret;
ret = qcom_scm_bw_enable();
if (ret)
goto disable_clk;
ret = qcom_scm_call(dev, desc, res);
qcom_scm_bw_disable();
disable_clk:
qcom_scm_clk_disable();
return ret;
}
next prev parent reply other threads:[~2024-03-06 18:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-04 13:14 [PATCH] firmware: qcom_scm: disable clocks if qcom_scm_bw_enable() fails Gabor Juhos
2024-03-04 16:20 ` Mukesh Ojha
2024-03-05 21:15 ` Konrad Dybcio
2024-03-06 4:10 ` Elliot Berman
2024-03-06 16:02 ` Konrad Dybcio
2024-03-06 18:01 ` Elliot Berman
2024-03-06 18:03 ` Gabor Juhos [this message]
2024-03-16 17:58 ` Bjorn Andersson
2024-03-17 16:27 ` Bjorn Andersson
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=f28633b9-cad8-4e1f-807c-830ba9368eb5@gmail.com \
--to=j4g8y7@gmail.com \
--cc=andersson@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_sibis@quicinc.com \
--cc=stable@vger.kernel.org \
/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