Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753810AbdCOLqi (ORCPT ); Wed, 15 Mar 2017 07:46:38 -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 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1661 Lines: 43 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; } -- 2.11.0