Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5840258imu; Wed, 30 Jan 2019 04:34:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN5/DZPH4A6BpQGEsaDIhsc+gHjMPgp+5vjfSenDehBEiQnMP7DVTPouq5h2bvuIE8V8SfzA X-Received: by 2002:a63:b105:: with SMTP id r5mr27512431pgf.442.1548851660149; Wed, 30 Jan 2019 04:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548851660; cv=none; d=google.com; s=arc-20160816; b=asHqn8kgDd0pEOskrm9bouuKKKVeeS5kcpeNKGBMLZW3zEx5ANKyjOWOIgnpOdCLon /3Ofnh5sM5Pnl7w4EYrqpGARndQw9noj8a9GWHruGqRB9Wm7jy6I0Hjrc906/TnQGbXe FUlbWbiNixSYjIRdFDfMnPmD00GJuc9qgWI35Cnq7obS341V26+NwZ9z8mhU2dEyLxAT dNVIegJ7WuMLo/QqYgPvyFM4OfmGg/SGBmIymLKjClKjQOrf12AWuqPUD6rt/qd3I95y AifeCtRcMVa+KczcY7RmVb91e6sSDPCgbgTPAqqnnHExf9wU240spjsTwvQuDMB2kv/3 3mpA== 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; bh=gIIvslPvqLr+/Mu/817XR9FqLh/QynuBWlQfDeZUFBw=; b=orvK+oDvsL1+VQQqKIWBtwlUGzvjSUyNe6BVCXJpUlcVKlDbD7EFzkfiMRernKO3Be myYjTERKyaLL4C2DtjD14HNwBhcqG9ghyB+RA4DDalFVRPpr9YEjrzjzlXaj26lRWzn8 OUyuhBuRPL49NJpqUAefnNgas3zeMSz8V3DeL1o/RkSm9DyEfgC7BkaCVLlknuBp+IHF YEyPcVOjVkPKQ5JPWWYFejNCe07pXWoJKxSIl9tr/d9Y8MFLZthPaHWaw0Ki+lNx16QJ ge8T3FO27vIxN+yQEI9Bl4pGMp5B+fgAl6ncwV1KuCPVNIG2upxl9vwIOeKnnAaxS5r5 0Gdw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si1213519pgp.540.2019.01.30.04.34.03; Wed, 30 Jan 2019 04:34:20 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728377AbfA3Mdw (ORCPT + 99 others); Wed, 30 Jan 2019 07:33:52 -0500 Received: from foss.arm.com ([217.140.101.70]:53504 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbfA3Mdw (ORCPT ); Wed, 30 Jan 2019 07:33:52 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 866ECEBD; Wed, 30 Jan 2019 04:33:51 -0800 (PST) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.197.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD1BC3F557; Wed, 30 Jan 2019 04:33:49 -0800 (PST) Date: Wed, 30 Jan 2019 12:33:47 +0000 From: Lorenzo Pieralisi To: honghui.zhang@mediatek.com Cc: bhelgaas@google.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ryder.lee@mediatek.com, youlin.pei@mediatek.com, jianjun.wang@mediatek.com Subject: Re: [PATCH] PCI: Mediatek: Use resource_size function on resource object Message-ID: <20190130123347.GB30991@e107981-ln.cambridge.arm.com> References: <1546409033-20412-1-git-send-email-honghui.zhang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1546409033-20412-1-git-send-email-honghui.zhang@mediatek.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 02, 2019 at 02:03:53PM +0800, honghui.zhang@mediatek.com wrote: > From: Honghui Zhang > > drivers/pci/pcie-mediatek.c:720:13-16: WARNING: Suspicious code. resource_size is maybe missing with mem > > Generated by: scripts/coccinelle/api/resource_size.cocci > > Signed-off-by: Honghui Zhang > --- > drivers/pci/controller/pcie-mediatek.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c > index e307166..0168376 100644 > --- a/drivers/pci/controller/pcie-mediatek.c > +++ b/drivers/pci/controller/pcie-mediatek.c > @@ -654,7 +654,6 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port) > struct resource *mem = &pcie->mem; > const struct mtk_pcie_soc *soc = port->pcie->soc; > u32 val; > - size_t size; > int err; > > /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */ > @@ -706,8 +705,7 @@ static int mtk_pcie_startup_port_v2(struct mtk_pcie_port *port) > mtk_pcie_enable_msi(port); > > /* Set AHB to PCIe translation windows */ > - size = mem->end - mem->start; > - val = lower_32_bits(mem->start) | AHB2PCIE_SIZE(fls(size)); > + val = lower_32_bits(mem->start) | AHB2PCIE_SIZE(fls(resource_size(mem))); checkpatch warns on this line, please make sure patches pass it before posting them. I will fix it up myself but please pay attention next time. Thanks, Lorenzo > writel(val, port->base + PCIE_AHB_TRANS_BASE0_L); > > val = upper_32_bits(mem->start); > -- > 2.6.4 >