Received: by 10.192.165.148 with SMTP id m20csp253129imm; Tue, 24 Apr 2018 21:50:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+tcvUkUrV7n+utXfPMCn2N/hP8ZcluhBJUv/ZljCJsuEhocNTYMlHWMOMkh6k1OqMQlBCC X-Received: by 10.98.27.13 with SMTP id b13mr26606469pfb.254.1524631850980; Tue, 24 Apr 2018 21:50:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524631850; cv=none; d=google.com; s=arc-20160816; b=uyzdWL4O+goFtOJha9iz223aMll1iBBwtjKGmjQOjhsMg0+ER1qywp/tmfzirbnBDR 74cycg5lj7+Id/WfwwCV42iJ9DattdOdjry2W0tRi0w3z00LmyohI/3j/446JaOXZa6z C4JeLVZGVZX1ZrQzhtz7ovVgvDdsnJJJapUFGlOnK22Gg7THPgZFPZbLJUitbdELG0AB k5fmIkOae2QXM6F7rBlm/ljEpiiDu0Tpgdx7U/wbtqem6ObqeSyhLEGy2diyBLEFk6jt ziXpLf96D++SS2Xt10E5BnaLGA1gqcqf+PjhRuvbWJv+c60xcs2bAT9ja85sPAZ6dTJj ysug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=DXZTzjTyfgi0VavPGCm4szgG74AmcYunebot1c/Fn7o=; b=jqBKu2T4NYtehPm8xtFiJ3/OTowwj4D0pv7xe05nyYNqKgK9QYPrr2PYDLipU+KLZQ mBGKvxxoILJmvuAeJWrr7MFIrBaBU+sQx6wbVwdYMB7+hfbVgSx5a5bddfLUtnjrZUdm ax6OfRudaRAZvBOeWly4TV/hs0sButGflCrhWmAL21f+VQ8cQbY5n8UAlAvARb6TrSIf wTVjq5cO91HWz6VmWhFFw2CGiF+WcJmxviYe9cL9De5BSC0XicJg4KMZN0L3evv5ANfP wqjht0rlmkAx+SNR28H/0WJdbQQu0l/340vODlh0lzaX7R1PB9rToCFhiTx6NLl7Mfo8 rYkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=En7LpeYW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3-v6si14298579plp.471.2018.04.24.21.50.36; Tue, 24 Apr 2018 21:50:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=En7LpeYW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751350AbeDYEt1 (ORCPT + 99 others); Wed, 25 Apr 2018 00:49:27 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35828 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962AbeDYEtY (ORCPT ); Wed, 25 Apr 2018 00:49:24 -0400 Received: by mail-pf0-f195.google.com with SMTP id j5so14134081pfh.2 for ; Tue, 24 Apr 2018 21:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DXZTzjTyfgi0VavPGCm4szgG74AmcYunebot1c/Fn7o=; b=En7LpeYWhngrzY0zU445H1UDJQlSx2gm2UgsAokTfIH/qyNo9WyiOVTNao0ysICrS4 uAfzIVQBE5mO+f3OYQ3U0x7oeqF4/TkI4nPhY//UhrqhV22pU/4yqxJpIi0aCjHFVrz6 r35UUMcX26ekQFidLhRm7ypXexw3h3Ly0nFXg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DXZTzjTyfgi0VavPGCm4szgG74AmcYunebot1c/Fn7o=; b=W9LaJcIr1M3GNTytg47LAz4EcZAEn+y2VXN/DVvkbw3DI7pFKTlV7h/q8iQ4ziA/VZ cdlzzMab3BO/sc3n444xAdEjBI5kfK4sMkGGAg4ajokdPEEVLY7ZmFmGmVTY2dg/UzKb geE8DwqR5uE2+PbauKiYz/iVLR38NCYlPtB7EP2kcs3jwzZBo35mHFekokVTYUmIXw67 MDagozevxLBCz+kWLCMuLMd7JSxYHiULNB1mKt0Io/t8JcoLDSrlqdptSXzf+kT1erVJ AskiueOsgob0xe3HISz9+MYFrpgx105b4nN90GWsmTvypbfnbxN3/pl3mPlKYOEA2WOI Cg4g== X-Gm-Message-State: ALQs6tA/mLJAYi5i3YPY/eUeRZgoZu0tsGNnjaboZUuK2OOSNnOtVCYI /ImRVCURnB818UQQetRKtToZQA== X-Received: by 2002:a17:902:7d86:: with SMTP id a6-v6mr28446156plm.264.1524631764379; Tue, 24 Apr 2018 21:49:24 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id v8sm9960926pfn.136.2018.04.24.21.49.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 21:49:23 -0700 (PDT) Date: Tue, 24 Apr 2018 21:50:33 -0700 From: Bjorn Andersson To: Alex Elder Cc: andy.gross@linaro.org, clew@codeaurora.org, aneela@codeaurora.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/6] soc: qcom: smem: fix qcom_smem_set_global_partition() Message-ID: <20180425045033.GI2052@tuxbook-pro> References: <20180410222542.29474-1-elder@linaro.org> <20180410222542.29474-6-elder@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410222542.29474-6-elder@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 10 Apr 15:25 PDT 2018, Alex Elder wrote: > If there is at least one entry in the partition table, but no global > entry, the qcom_smem_set_global_partition() should return an error > just like it does if there are no partition table entries. > > It turns out the function still returns an error in this case, but > it waits to do so until it has mistakenly treated the last entry in > the table as if it were the global entry found. > > Fix the function to return immediately if no global entry is found > in the table. > > Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/soc/qcom/smem.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > index 0ed263055988..6e42599b70d4 100644 > --- a/drivers/soc/qcom/smem.c > +++ b/drivers/soc/qcom/smem.c > @@ -698,9 +698,10 @@ static u32 qcom_smem_get_item_count(struct qcom_smem *smem) > static int qcom_smem_set_global_partition(struct qcom_smem *smem) > { > struct smem_partition_header *header; > - struct smem_ptable_entry *entry = NULL; > + struct smem_ptable_entry *entry; > struct smem_ptable *ptable; > u32 host0, host1, size; > + bool found = false; > int i; > > ptable = qcom_smem_get_ptable(smem); > @@ -712,11 +713,13 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) > host0 = le16_to_cpu(entry->host0); > host1 = le16_to_cpu(entry->host1); > > - if (host0 == SMEM_GLOBAL_HOST && host0 == host1) > + if (host0 == SMEM_GLOBAL_HOST && host0 == host1) { > + found = true; > break; > + } > } > > - if (!entry) { > + if (!found) { > dev_err(smem->dev, "Missing entry for global partition\n"); > return -EINVAL; > } > -- > 2.14.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html