From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Jonathan Neusch?fer <j.neuschaefer@gmx.net>,
linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
Andy Gross <andy.gross@linaro.org>,
David Brown <david.brown@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] soc: qcom: smsm: Handle probe deferral
Date: Tue, 4 Apr 2017 04:38:07 +0200 [thread overview]
Message-ID: <20170404023807.4ivn4pt4zv2bq4di@latitude> (raw)
In-Reply-To: <20170328061829.GI70446@Bjorns-MacBook-Pro-2.local>
[-- Attachment #1: Type: text/plain, Size: 2610 bytes --]
On Mon, Mar 27, 2017 at 11:18:29PM -0700, Bjorn Andersson wrote:
> On Wed 15 Mar 04:43 PDT 2017, Jonathan Neusch?fer wrote:
[...]
> > info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SIZE_INFO, &size);
> > - if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) {
> > + if (PTR_ERR(info) == -EPROBE_DEFER) {
> > + return PTR_ERR(info);
> > + } else if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) {
>
> The following elseif was supposed to take care of this case, but I
> clearly screwed this up.
>
> Rather than adding a special case for EPROBE_DEFER before the two checks
> and then fix up the original expression to make errors fall back to the
> original else, I think you should rearrange the conditionals.
>
> Probably better to write it like this instead:
>
> if (IS_ERR(info) && PTR_ERR(info) != -ENOENT) {
> if (PTR_ERR(info) != -EPROBE_DEFER)
> dev_err(smsm->dev, "unable to retrieve smsm size info\n");
> return PTR_ERR(info);
> } else if (IS_ERR(info) || size != sizeof(*info)) {
> dev_warn(smsm->dev, "no smsm size info, using defaults\n");
> smsm->num_entries = SMSM_DEFAULT_NUM_ENTRIES;
> smsm->num_hosts = SMSM_DEFAULT_NUM_HOSTS;
> return 0;
> }
Indeed, this looks better.
And it also obsoletes my patch 2/2, which is nice.
> > dev_warn(smsm->dev, "no smsm size info, using defaults\n");
> > smsm->num_entries = SMSM_DEFAULT_NUM_ENTRIES;
> > smsm->num_hosts = SMSM_DEFAULT_NUM_HOSTS;
> > @@ -515,7 +517,9 @@ static int qcom_smsm_probe(struct platform_device *pdev)
> > /* Acquire the main SMSM state vector */
> > ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SHARED_STATE,
> > smsm->num_entries * sizeof(u32));
> > - if (ret < 0 && ret != -EEXIST) {
> > + if (ret == -EPROBE_DEFER) {
> > + return ret;
> > + } else if (ret < 0 && ret != -EEXIST) {
>
> The idiomatic way to write this is:
>
> if (ret < 0 && ret != -EEXIST) {
> if (ret != -EPROBE_DEFER)
> dev_err();
> return ret;
> }
>
> However, for us to reach this point in smsm_probe() the above
> qcom_smem_get() must have returned successfully, i.e. we have SMEM in
> place so there's no need to handle this case specifically.
I came to the same conclusion but wasn't sure. I'll drop this part from
my patch.
I'll send a v2 of this series, although after applying your suggestions,
I can't claim much originality anymore.
Thanks for the review,
Jonathan Neuschäfer
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-04-04 2:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 11:43 Jonathan Neuschäfer
2017-03-15 11:43 ` [PATCH 2/2] soc: qcom: smsm: Avoid the use of an uninitialized value Jonathan Neuschäfer
2017-03-17 14:01 ` [PATCH 1/2] soc: qcom: smsm: Handle probe deferral Jonathan Neuschäfer
2017-03-28 6:18 ` Bjorn Andersson
2017-04-04 2:38 ` Jonathan Neuschäfer [this message]
2017-04-05 3:47 ` Bjorn Andersson
2017-04-05 12:10 ` [PATCH v2] soc: qcom: smsm: Improve error handling, quiesce " Jonathan Neuschäfer
2017-04-05 17:01 ` Bjorn Andersson
2017-05-31 14:00 ` Jonathan Neuschäfer
2017-06-01 6:34 ` Andy Gross
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=20170404023807.4ivn4pt4zv2bq4di@latitude \
--to=j.neuschaefer@gmx.net \
--cc=andy.gross@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=david.brown@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-soc@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
all inboxes | Powered by JetHome®