From patchwork Wed Apr 5 12:10:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 9663861 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6EA32602B5 for ; Wed, 5 Apr 2017 12:16:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62F9C284BC for ; Wed, 5 Apr 2017 12:16:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5471C283BA; Wed, 5 Apr 2017 12:16:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D55A5283BA for ; Wed, 5 Apr 2017 12:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755203AbdDEMPI (ORCPT ); Wed, 5 Apr 2017 08:15:08 -0400 Received: from mout.gmx.net ([212.227.15.19]:49811 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755356AbdDEMN7 (ORCPT ); Wed, 5 Apr 2017 08:13:59 -0400 Received: from latitude.space.aachen.ccc.de ([87.78.36.100]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MOf5S-1czZ2r3BX4-0065lq; Wed, 05 Apr 2017 14:13:55 +0200 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= To: linux-arm-msm@vger.kernel.org, Bjorn Andersson Cc: linux-soc@vger.kernel.org, Andy Gross , David Brown , linux-kernel@vger.kernel.org, =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Subject: [PATCH v2] soc: qcom: smsm: Improve error handling, quiesce probe deferral Date: Wed, 5 Apr 2017 14:10:48 +0200 Message-Id: <20170405121048.31800-1-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170404023807.4ivn4pt4zv2bq4di@latitude> References: <20170404023807.4ivn4pt4zv2bq4di@latitude> MIME-Version: 1.0 X-Provags-ID: V03:K0:zM///qflS4K3SXd0yli7oYK7iu1/SG+ra9uRAVDnowTzHnRhTrJ hfvln4qkaXgnTgRxcsWedgIKejvYRaTmWnDBoKsKuIs00637Pyob06og3jESqmzP0mmcKH2 pbnhoIpMFRUAFfZ8U454BqLEeEmUOcYyd1A3XeGDqbUgHSsREqAKmqFi+JDVwV635EjSs+V M9pWUO0YlkxxNYJJg1cUw== X-UI-Out-Filterresults: notjunk:1; V01:K0:R4tKWl14mtY=:Yu67ZHEbiY8VUSdslBlJaK j6NJcR5CzJdWCvCCNB/0k8BjAZ0k160IDvA3p1qOkEU0KriLse1Y7Rcei9ivvI0OzStadYFZx VZCRBnCH1IZ5BK1jfqhfrSpFGu8hqw9923a+NIPKIstHn/CIfVwaU+mgyty3PcSQ+L0DTOQvV JpbzJt1QhfsnwQCwMWBfJEQwrcxjSP8wJxqyMTBIiO7i2+8rBZkCS1pIaxeprwJzb2TzzkRji vFLj7yieDuOsahC4usSzLdMHZJXrn5dQbrdyLpEorPMDHJ9rcsJd3b3qJS+qzagoZ02L0XsUr WKjmVKEScFPTpNPw4ykCSXjdDpWbk3uicJ4gXvNiT4oapyvmD9a03Tw4BKJYILAwPe+aOEq74 xqFEyOEdoTODCom2GySfB7V0oeo02ezc5lUAOVt4PGoFQdTjGQUbQBYehPtMDgGXOVnWkib4r 64GXvA+DRgD1G0+B0ngpU0JDdAaBWeVz3vUygsYlaLTaeInyLaD4Of5ftzAhTYcv5mCrGYrtd wPqIs3xp4WDivwkMxILc9s9yEKHehXOAdeD9Wwe+ntBz7PefubEFNT7J84DUhzppeIrUwuAUd S87tM8j4pNpCTmcXCsu9teAFE0ELHc7hHSPIRoky7h3gvhRf1w/jZP3OooHLSBzjCsiIAaVqD DPTKxt1LrLAHEW9Fztry1mRokHqBdAjhG3XUatv11VlF2G5IS/PGLvzmQVEeGFHALL+dvrhkH HC/mWEYHl7gfYaY9FUvMI2LXCt4cK2Ae2kZ+JGH+wx4D7Q3SqPaJA+3Scs2KabF5DcuqASOnv +xg4lLw Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Bjorn Andersson --- 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;