Received: by 10.192.165.148 with SMTP id m20csp254686imm; Tue, 24 Apr 2018 21:53:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+czu9ENfdNKXfzxwDrs2XWfNPEQD7neBdIef9QLufx9PqgbwjsMmeaOJ07v70Gq7I2LeId X-Received: by 2002:a17:902:758a:: with SMTP id j10-v6mr28020985pll.334.1524631992796; Tue, 24 Apr 2018 21:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524631992; cv=none; d=google.com; s=arc-20160816; b=a6/51+JDs/4e2W6X23PiP9DVQGmU91Kkt4EMTwHS/q8Z99ZwD7vItt12scCsawjWvt 0nydobO2QSQNiZMbLdcNDyfD+M2w9v9ANulD6IJrhX0Qs9aPNTVTk6iuxGJcs6U+2cpK STLFuXtO0N/Ig7xtRt3p48LUevHHses/pvN1K0Cd5DJBzXJMIU7iW20K2AMQiStF5lN6 CqW9RMXs7KhHlioOeyr8dSs90/2KkHnusO2HcvYxdb/CD1895vD4DYt/w86o20nTBzEt Afc6xl/2O13y0obzWul3FJIxxL099fV3rkbtgoccwMUAbJ6ICSEZB5P8kI+M/ntbdVxg gnVw== 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=Ue0VUfcK+MFlEw2xeZX6IOCTiz+S3Cs/JlBA0K5BWMo=; b=Cl5qxvbo5118ungd/VIxc/B8GyTdd91XxspCx5KoQ5pjLlr0ldsjKNfStCRK2fqUhI 7gGbhgK2TFUjBk4jB9laB3NMkzoWp3oU4GUhKRXSLPCGK802NVLQtnFtj+a2J8s2Cz9Q oQ8M25kMR6529yVhUqSESpay19P8sCYTGP4L7L6CUz6xtgdi5d7h7aoHyxiWufddFczy ZIr3SeRSfHUzWqGCyOgeBQ7+uo/9SuwW0/9XCIH481jVKQKmvEZHwg4JqFH4DrzVBwbO bG4Ge6+ivojSEDPG3o51kcPrfFH3yoVo4Eng1CLQcKwWRv7xkwyII7vpB0JybvIHEFdv FXXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DyNGgEXt; 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 b2-v6si15980131pla.365.2018.04.24.21.52.58; Tue, 24 Apr 2018 21:53:12 -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=DyNGgEXt; 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 S1751093AbeDYEvx (ORCPT + 99 others); Wed, 25 Apr 2018 00:51:53 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:43751 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeDYEvv (ORCPT ); Wed, 25 Apr 2018 00:51:51 -0400 Received: by mail-pg0-f67.google.com with SMTP id f132so12448697pgc.10 for ; Tue, 24 Apr 2018 21:51:51 -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=Ue0VUfcK+MFlEw2xeZX6IOCTiz+S3Cs/JlBA0K5BWMo=; b=DyNGgEXtRwVcTR9N6tz4HH3lcjC09sRxMyqe+hO2a49k5yTLHJ2zWfZZicXdYdrrsk V9D5qtItD6GabVb7vqjpJrY2UhFlqB0HoebXajl/QX/wi9oWi6shAz1o8KRjpXU2LORp pifXeinhtBCaTMPieB4Nklbb/uL+QltRGi5ac= 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=Ue0VUfcK+MFlEw2xeZX6IOCTiz+S3Cs/JlBA0K5BWMo=; b=bpYJbGYzVO66Xw04QDAcRh268o92sdcAaszqm7RqVM1CbbOVZsi2r7p9yuwkcpYPaJ qOAznMOfMZzgmt//gMEQH3+6RLJQGlAOZP9iyF0c2+xOCdNpdRPpOy6wnU7htAGgdJSG 5UkMUaj71b7/dyUbDjxEVAcQ04CoIlxyQWZJeghG2BrOyO6+1AkWFhdTt4muyR4LQt7h APD2m+pynTGNepUK2VEL8XQNyH2exzsMFVT+ct6W068PuyR7cQeh4teaeho9B91rfBeM Z3AlAtZGOLqEd29Y5+nELm0fyOax4p698hWIlB0U6sBMs8r59FP5HxXBP7UkoPqYfLdh r/pA== X-Gm-Message-State: ALQs6tD1t7XlXqiOAhsFZa9893EdU7whz87WYUt0M0USlYeOdomPkbke +x8EA9TMJnn/aSUIUJcmfFiATw== X-Received: by 10.99.124.20 with SMTP id x20mr22702623pgc.161.1524631910737; Tue, 24 Apr 2018 21:51:50 -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 y7sm37588030pfi.185.2018.04.24.21.51.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 21:51:49 -0700 (PDT) Date: Tue, 24 Apr 2018 21:52:59 -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 6/6] soc: qcom: smem: check sooner in qcom_smem_set_global_partition() Message-ID: <20180425045259.GJ2052@tuxbook-pro> References: <20180410222542.29474-1-elder@linaro.org> <20180410222542.29474-7-elder@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410222542.29474-7-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: > There's no sense in scanning the partition table again if we know > the global partition has already been discovered. Check for a > non-null global_partition pointer in qcom_smem_set_global_partition() > immediately. > > Signed-off-by: Alex Elder Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/soc/qcom/smem.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > index 6e42599b70d4..7d9a43da5084 100644 > --- a/drivers/soc/qcom/smem.c > +++ b/drivers/soc/qcom/smem.c > @@ -364,6 +364,11 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, > end = phdr_to_last_uncached_entry(phdr); > cached = phdr_to_last_cached_entry(phdr); > > + if (smem->global_partition) { > + dev_err(smem->dev, "Already found the global partition\n"); > + return -EINVAL; > + } > + > while (hdr < end) { > if (hdr->canary != SMEM_PRIVATE_CANARY) > goto bad_canary; > @@ -729,11 +734,6 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) > return -EINVAL; > } > > - if (smem->global_partition) { > - dev_err(smem->dev, "Already found the global partition\n"); > - return -EINVAL; > - } > - > header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); > host0 = le16_to_cpu(header->host0); > host1 = le16_to_cpu(header->host1); > -- > 2.14.1 >