From: "Sajida Bhanu (Temp)" <quic_c_sbhanu@quicinc.com>
To: Philipp Zabel <p.zabel@pengutronix.de>, <adrian.hunter@intel.com>,
<agross@kernel.org>, <bjorn.andersson@linaro.org>,
<ulf.hansson@linaro.org>, <chris@printf.net>,
<venkatg@codeaurora.org>, <gdjakov@mm-sol.com>,
<quic_asutoshd@quicinc.com>
Cc: <linux-mmc@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <quic_rampraka@quicinc.com>,
<quic_pragalla@quicinc.com>, <quic_sartgarg@quicinc.com>,
<quic_nitirawa@quicinc.com>, <quic_sayalil@quicinc.com>
Subject: Re: [PATCH V4] mmc: sdhci-msm: Reset GCC_SDCC_BCR register for SDHC
Date: Sun, 24 Apr 2022 15:52:50 +0530 [thread overview]
Message-ID: <e85dace0-66f5-6ef1-425a-d5cff4278c19@quicinc.com> (raw)
In-Reply-To: <9b2b9460e46d8544867589ce61d380265f42cd04.camel@pengutronix.de>
Hi,
Thanks for the review.
Please find the inline comments.
Thanks,
Sajida
On 4/21/2022 3:26 PM, Philipp Zabel wrote:
> On Do, 2022-04-21 at 10:32 +0530, Sajida Bhanu (Temp) wrote:
>> Hi,
>>
>> Thanks for the review.
>>
>> Please find the inline comments.
>>
>> Thanks,
>>
>> Sajida
>>
>> On 4/19/2022 12:52 PM, Philipp Zabel wrote:
>>> Hi Sajida,
>>>
>>> On Di, 2022-04-19 at 11:46 +0530, Sajida Bhanu (Temp) wrote:
>>> [...]
>>>>>> +static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host)
>>>>>> +{
>>>>>> + struct reset_control *reset;
>>>>>> + int ret = 0;
>>>>> No need to initialize ret.
>>>>>
>>>>>> +
>>>>>> + reset = reset_control_get_optional_exclusive(dev, NULL);
>>>>>> + if (IS_ERR(reset))
>>>>>> + return dev_err_probe(dev, PTR_ERR(reset),
>>>>>> + "unable to acquire core_reset\n");
>>>>>> +
>>>>>> + if (!reset)
>>>>>> + return ret;
>>>> Here we are returning ret directly if reset is NULL , so ret
>>>> initialization is required.
>>> You are right. I would just "return 0;" here, but this is correct as
>>> is.
>> Ok
>>>>>> +
>>>>>> + ret = reset_control_assert(reset);
>>>>>> + if (ret)
>>>>>> + return dev_err_probe(dev, ret, "core_reset assert failed\n");
>>>>> Missing reset_control_put(reset) in the error path.
>>>> Sure will add
>>>>>> +
>>>>>> + /*
>>>>>> + * The hardware requirement for delay between assert/deassert
>>>>>> + * is at least 3-4 sleep clock (32.7KHz) cycles, which comes to
>>>>>> + * ~125us (4/32768). To be on the safe side add 200us delay.
>>>>>> + */
>>>>>> + usleep_range(200, 210);
>>>>>> +
>>>>>> + ret = reset_control_deassert(reset);
>>>>>> + if (ret)
>>>>>> + return dev_err_probe(dev, ret, "core_reset deassert failed\n");
>>>>> Same as above. Maybe make both ret = dev_err_probe() and goto ...
>>>> In both cases error message is different so I think goto not good idea here.
>>> You could goto after the error message. Either way is fine.
>> Sorry didn't get this ..can you please help
> I meant you could either use goto after the error messages:
>
> +static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host)
> +{
> [...]
> + ret = reset_control_assert(reset);
> + if (ret) {
> + dev_err_probe(dev, ret, "core_reset assert failed\n");
> + goto out_reset_put;
> + }
> [...]
> + ret = reset_control_deassert(reset);
> + if (ret) {
> + dev_err_probe(dev, ret, "core_reset deassert failed\n");
> + goto out_reset_put;
> + }
> +
> + usleep_range(200, 210);
> +
> +out_reset_put:
> + reset_control_put(reset);
> +
> + return ret;
> +}
>
> Or not use goto and copy the reset_control_put() into each error path:
>
> +static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host)
> +{
> [...]
> + ret = reset_control_assert(reset);
> + if (ret) {
> + reset_control_put(reset);
> + return dev_err_probe(dev, ret, "core_reset assert failed\n");
> + }
> [...]
> + ret = reset_control_deassert(reset);
> + if (ret) {
> + reset_control_put(reset);
> + return dev_err_probe(dev, ret, "core_reset deassert failed\n");
> + }
> +
> + usleep_range(200, 210);
> + reset_control_put(reset);
> +
> + return 0;
> +}
>
> regards
> Philipp
Sure I will call reset_control_put() in each error path
prev parent reply other threads:[~2022-04-24 10:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 10:39 Shaik Sajida Bhanu
2022-04-12 11:00 ` Philipp Zabel
2022-04-19 6:16 ` Sajida Bhanu (Temp)
2022-04-19 7:22 ` Philipp Zabel
2022-04-21 5:02 ` Sajida Bhanu (Temp)
2022-04-21 9:56 ` Philipp Zabel
2022-04-24 10:22 ` Sajida Bhanu (Temp) [this message]
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=e85dace0-66f5-6ef1-425a-d5cff4278c19@quicinc.com \
--to=quic_c_sbhanu@quicinc.com \
--cc=adrian.hunter@intel.com \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=chris@printf.net \
--cc=gdjakov@mm-sol.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_pragalla@quicinc.com \
--cc=quic_rampraka@quicinc.com \
--cc=quic_sartgarg@quicinc.com \
--cc=quic_sayalil@quicinc.com \
--cc=ulf.hansson@linaro.org \
--cc=venkatg@codeaurora.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
all inboxes | Powered by JetHome®