soc: qcom: smsm: Improve error handling, quiesce probe deferral
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Wed, 5 Apr 2017 12:10:48 +0000 (14:10 +0200)
committerAndy Gross <andy.gross@linaro.org>
Tue, 6 Jun 2017 02:50:44 +0000 (21:50 -0500)
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>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
drivers/soc/qcom/smsm.c

index d0337b2a71c81b57eaae7ec4e5bf921055cbb766..dc540ea92e9d8649de0ef405eca6a146b452a886 100644 (file)
@@ -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;