From patchwork Wed Mar 15 11:43:57 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: 9625457 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 5F6426048C for ; Wed, 15 Mar 2017 11:47:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D91528159 for ; Wed, 15 Mar 2017 11:47:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4236628343; Wed, 15 Mar 2017 11:47:21 +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 EE4B828159 for ; Wed, 15 Mar 2017 11:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753565AbdCOLqf (ORCPT ); Wed, 15 Mar 2017 07:46:35 -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 Received: from localhost.localdomain ([88.153.7.82]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M7pku-1c1wc90TUO-00vRRO; Wed, 15 Mar 2017 12:46:21 +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 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 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-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 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;