diff mbox

[v2] soc: qcom: smsm: Improve error handling, quiesce probe deferral

Message ID 20170405121048.31800-1-j.neuschaefer@gmx.net (mailing list archive)
State Accepted, archived
Delegated to: Andy Gross
Headers show

Commit Message

J. Neuschäfer April 5, 2017, 12:10 p.m. UTC
Don't use size if info indicates an error condition. Previously a
non-ENOENT error (such as -EPROBE_DEFER) would lead to size being used
even though it hadn't necessarily been initialized in qcom_smem_get.

Don't print an error message in the -EPROBE_DEFER case.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

---
v2:
- Rewrite based on Bjorn's suggestion.
- Don't check for -EPROBE_DEFER again after qcom_smem_alloc was called
  in qcom_smsm_probe. This point is only reached if smsm_get_size_info
  returned success, which can only happen if probe deferral is over.
v1:
- was "[PATCH 1/2] soc: qcom: smsm: Handle probe deferral"
---
 drivers/soc/qcom/smsm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Bjorn Andersson April 5, 2017, 5:01 p.m. UTC | #1
On Wed 05 Apr 05:10 PDT 2017, Jonathan Neusch?fer wrote:

> Don't use size if info indicates an error condition. Previously a
> non-ENOENT error (such as -EPROBE_DEFER) would lead to size being used
> even though it hadn't necessarily been initialized in qcom_smem_get.
> 
> Don't print an error message in the -EPROBE_DEFER case.
> 
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> 
> ---
> v2:
> - Rewrite based on Bjorn's suggestion.
> - Don't check for -EPROBE_DEFER again after qcom_smem_alloc was called
>   in qcom_smsm_probe. This point is only reached if smsm_get_size_info
>   returned success, which can only happen if probe deferral is over.
> v1:
> - was "[PATCH 1/2] soc: qcom: smsm: Handle probe deferral"
> ---
>  drivers/soc/qcom/smsm.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
> index d0337b2a71c8..dc540ea92e9d 100644
> --- a/drivers/soc/qcom/smsm.c
> +++ b/drivers/soc/qcom/smsm.c
> @@ -439,14 +439,15 @@ static int smsm_get_size_info(struct qcom_smsm *smsm)
>  	} *info;
>  
>  	info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SIZE_INFO, &size);
> -	if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) {
> +	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;
> -	} else if (IS_ERR(info)) {
> -		dev_err(smsm->dev, "unable to retrieve smsm size info\n");
> -		return PTR_ERR(info);
>  	}
>  
>  	smsm->num_entries = info->num_entries;
> -- 
> 2.11.0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
J. Neuschäfer May 31, 2017, 2 p.m. UTC | #2
On Wed, Apr 05, 2017 at 10:01:23AM -0700, Bjorn Andersson wrote:
> On Wed 05 Apr 05:10 PDT 2017, Jonathan Neusch?fer wrote:
> 
> > Don't use size if info indicates an error condition. Previously a
> > non-ENOENT error (such as -EPROBE_DEFER) would lead to size being used
> > even though it hadn't necessarily been initialized in qcom_smem_get.
> > 
> > Don't print an error message in the -EPROBE_DEFER case.
> > 
> > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> 
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Ping. Andy, are you going to merge this patch?


Thanks,
Jonathan
Andy Gross June 1, 2017, 6:34 a.m. UTC | #3
On Wed, May 31, 2017 at 04:00:03PM +0200, Jonathan Neuschäfer wrote:
> On Wed, Apr 05, 2017 at 10:01:23AM -0700, Bjorn Andersson wrote:
> > On Wed 05 Apr 05:10 PDT 2017, Jonathan Neusch?fer wrote:
> > 
> > > Don't use size if info indicates an error condition. Previously a
> > > non-ENOENT error (such as -EPROBE_DEFER) would lead to size being used
> > > even though it hadn't necessarily been initialized in qcom_smem_get.
> > > 
> > > Don't print an error message in the -EPROBE_DEFER case.
> > > 
> > > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
> > 
> > Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> Ping. Andy, are you going to merge this patch?

Yes.  I queued this one up on my list of patches.

Regards,

Andy

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index d0337b2a71c8..dc540ea92e9d 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -439,14 +439,15 @@  static int smsm_get_size_info(struct qcom_smsm *smsm)
 	} *info;
 
 	info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SIZE_INFO, &size);
-	if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) {
+	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;
-	} else if (IS_ERR(info)) {
-		dev_err(smsm->dev, "unable to retrieve smsm size info\n");
-		return PTR_ERR(info);
 	}
 
 	smsm->num_entries = info->num_entries;