Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753685AbdCOLqh (ORCPT ); Wed, 15 Mar 2017 07:46:37 -0400 Received: from mout.gmx.net ([212.227.15.18]:49851 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753555AbdCOLqY (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 2/2] soc: qcom: smsm: Avoid the use of an uninitialized value Date: Wed, 15 Mar 2017 12:43:57 +0100 Message-Id: <20170315114357.14446-2-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170315114357.14446-1-j.neuschaefer@gmx.net> References: <20170315114357.14446-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:hcRdY0W5LBlvX1CwsWiR4nQcMhBpCnZWFR4pTq8ukbt8tSJ28fc y+A5glXl629N0TAI1J8jWGsXPQXsgctDwMBz+iqO2t/pQIrMTtiBeBC8L1OpuIAw2gQP2GQ Fd6X/EUD6fv+ClGjJ8bpJKFuyWVN+AAuVoipmYsMZouC/VXx42Rxw8Crt99jrTYBZc0DIaR vkbVm9Q8f2bqNq2f1ojPw== X-UI-Out-Filterresults: notjunk:1;V01:K0:OSyz0J6XGoA=:nAU1srUhcBLLeVoZp9FfJS bbIAvtOZ2G09xLaBC6zW9DmMGXRXx+liWMHiocDTi/BIkZ743Te0xNcw2XQtqp5R/zet5EO8B XbaxHoetGXhBs2UEc0U5Vix/hXn77rjqrnIdpH+/m+z44fp6rC4p/s12uELpT3cstbwvxZFEC lv8jxFq/SjfS2ZkEA7vomodHNil5pJy1lmZ1P4mflad2jU7eEZiSLtwpc0Dk6Xnf89R0aUrBs D2Our7fo+CF+SHHVhqnJoy0830I7cbJS/kUsai34oDsd17hRnt6yVHseedHCEZz1kD8tRG4Qx LfFx3Z9rFsN1TY0uYQKOvfHVHraxZ48Wgys8+zn+DxJA6lbO4V6C7AGvsy+9RtR+Cw1uf7vqJ e/cxh2BTOxBEL1TxMvApnAIVyWLjBjhJjJnhDa6AP5wS+O+NwWJZcCBFXRTevmLc3gEzY+clf Q8zKwkp7fcXE3jrSVn10c8DaySOxbDbwPOGbCY6uJ2cc0BfuFy3IfJhTUbqpBSLdLdBxXWDm/ 2BU/cRH+Q8kCMFuyoNT99S0pd0D0VC25r93lky/1i9iFCzGz8AxYu+Nf9+o4Mla2CIZbVFLTq FV+dFYpH2PuibBvjtqG8CUMdLFPADD00gWKCLGqIcmJiOvzwNu1kqtZ1T7LdhjrE3Yise4/cC XLD01gfZrwBmQ06nmOM/wTs0XhurhNZb9vVMkzh0ldcALzSAwInzzpSvggw3ksiPR8KL33gP1 H5jTyGzwU326AGpPOawX1Q/VjeepsJOPw+Mmm8BuyQLLIHkVHpUcPOJy9pF4OvOSJL3rCviW4 ZaA8Fg5PT+t6TJfkXB7FvQx392Ftg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 949 Lines: 24 If qcom_smem_get returns an error besides -EPROBE_DEFER or -ENOENT, don't assume that size has been set. Signed-off-by: Jonathan Neuschäfer --- drivers/soc/qcom/smsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c index 3918645e5708..632c060c9cc0 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -441,7 +441,8 @@ static int smsm_get_size_info(struct qcom_smsm *smsm) info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SIZE_INFO, &size); if (PTR_ERR(info) == -EPROBE_DEFER) { return PTR_ERR(info); - } else if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) { + } else if (PTR_ERR(info) == -ENOENT || + (!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; -- 2.11.0