From patchwork Wed Mar 15 11:43:56 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: 9625455 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 073A56048C for ; Wed, 15 Mar 2017 11:47:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E94ED28159 for ; Wed, 15 Mar 2017 11:47:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDF0528343; Wed, 15 Mar 2017 11:47:18 +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 95C2528159 for ; Wed, 15 Mar 2017 11:47:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753575AbdCOLqg (ORCPT ); Wed, 15 Mar 2017 07:46:36 -0400 Received: from mout.gmx.net ([212.227.15.18]:60462 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752164AbdCOLqY (ORCPT ); Wed, 15 Mar 2017 07:46:24 -0400 Received: from localhost.localdomain ([88.153.7.82]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Ln7wj-1cI5sv38yD-00hLrv; Wed, 15 Mar 2017 12:46:20 +0100 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= To: linux-arm-msm@vger.kernel.org Cc: Bjorn Andersson , linux-soc@vger.kernel.org, Andy Gross , David Brown , linux-kernel@vger.kernel.org, =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Subject: [PATCH 1/2] soc: qcom: smsm: Handle probe deferral Date: Wed, 15 Mar 2017 12:43:56 +0100 Message-Id: <20170315114357.14446-1-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:nMdKCezErRm+LT9T1EwRZQgUZKsFAgWmsczQMN6SxuI1mMEFsxp 30jJviUi/kLDWPV5wWQKLtTzxouSPp2hrtBRfmos9x3dg0iwXYBFi5GF0umwyMJCuAaZ/b+ CmQU2eFRDfwV/h0+6//q5VE/N2K+9Smwn2ctadKfKOmeLuqFV9pXjblnryBN8WOr9Q/IGXL 82HEP/W9xz27qhE/qm8uA== X-UI-Out-Filterresults: notjunk:1; V01:K0:GPS2EKe5d7A=:GZ6p1cSmgc4py3w3jhw6NN E9d0RZOpvIg2GpnD4DDmd/cQ5TXD14UbwB4GHvyzo/i4fvwbH1k7syEnX6yi27R0eWL8RHg6M 6NvpXaqKpJzF9RMpaWrgg7wdY+Ixvq67KyWRyNlggKIvdg3n4Pg7L8qmHHJebrr2E5nHQdAUo kFeBjed0XhR4Z3c/9U0E2tueiQPcdrqLPGcx76DAViY+AVAzNDeeG6c8qjbx0RnQGQw3x1BAy DCVccm95ArALGH20duM/EQeWZdFoilNo3jRv7Wx/dnfDAts4c08fR3QffwARM+S9ninIPuh45 PJaNP30+fJ/m81emmeF2dY8L0ao51iaNAkfeEv6FvdHTjxRQ411TT1egr02LNhs3E/CG7NDgL 9HGDcDV2QyrNIQa6JpQUxN95B3mJfSR8zCxL7K1psLgYq5g7l+4EqcQrDQ9lD/zumkb2D6IBl sRK3MQ18oT4ai+mU0/d9Mn/Ux7rvs/5necA4t/bCm1j+qGOcgHD3KnzaUscHDjPYL9QFob6EI jp0argS3kfks4eQreGH3zzSm2fj1TD8Te8dcXi6z+4zJwoDiOk5qdkNmAG1CvNCd/ElLBFkpw sEztNL1OZbX1CI/qGuPTnxModuAhNr41HahFrRViGH0BhsIf1TeTToGM6incCfSFymRYMUtE1 lF9Xq+drZzXnBYnh7olZ3Yktnrkjtn7VitlbwPA+1V3CQ/0XimzRiPhjlf6zB+ggLIcTbq7tX bJNDAnKVha1EfppSOPX8KaYlVYnHuZDQbuVLV0RRm6Wb9GPNr1jKlsWe1NCwyDFA7fgiPp02v SShrBhSNn4Aocd6O+8D6uef8yD4ag== 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 If qcom_smem_get or qcom_smem_alloc return -EPROBE_DEFER, let the caller the caller handle it, instead of treating it as an error. Signed-off-by: Jonathan Neuschäfer --- v1: - TODO: Reading qcom_smsm_probe, I noticed memory leaks in error paths: smsm, smsm->entries, etc. are allocated (with devm_kzalloc), but not freed when the function returns early. This should be addressed at some point (in a separate patch). --- drivers/soc/qcom/smsm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c index d0337b2a71c8..3918645e5708 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -439,7 +439,9 @@ 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 (PTR_ERR(info) == -EPROBE_DEFER) { + return PTR_ERR(info); + } else if (PTR_ERR(info) == -ENOENT || 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; @@ -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) { dev_err(&pdev->dev, "unable to allocate shared state entry\n"); return ret; }