Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6051044imu; Wed, 30 Jan 2019 08:01:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN5gLVRwCf36g3seCsprMiskh/RGwLguK3NZi8ub/76ozTzDtMEPFO8rl9Jxr0QDGucJiE5K X-Received: by 2002:a63:955a:: with SMTP id t26mr28235960pgn.449.1548864073101; Wed, 30 Jan 2019 08:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548864073; cv=none; d=google.com; s=arc-20160816; b=Yhb7pDW+AKdyrZKBBCvl6cxFA3FnE7LkKXEgtD3AdVDt+WfrM1AyGvqIgQlnMt41Gp sPBC6HAw5VdUPRZQiZpIxF1tHxyZ6gYHAS7iEfLZvmGEp0CHjpuMHUQSvGLgGF+md1Wb xtunbeSGHMo5Fh12K9AlG48fkKxxTL1Iyk/ef5zdbU+YaxVNlle30UdM6oDF7CEWHFAC 7lEQEllzAtxPoASvyzKOnGfp8y+2TqrlnsKFsAKYXhKSkOJ5vA1biq1m9fE47j5+3bDA eNdhn/HStbkEbM/QpjfVFNvbmSxFO3cBcB1/r2KRtJ4ByB83kWMUWLDycI/3c4dGOaVw P8JQ== 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; bh=SLxTxbQOZkopXof/a98cz0QvlVt4mE27b3jg8iTxs1w=; b=LEP864b8EJyoT0CrEJMMxNsElgy47/E2lSxpEQhNFw1R8f2l3RNtD7QWKbOpL/nnm+ bPg09GpbcUGX/mdLRbeUt08J40wMZZqNaQ7ec7V9tJo1oFEDCZGyAF5OK0zMoqkCMPbl e4r3ax2rASFBF1estdYLEp4nOhTiBePyzxiKnoKwod4sNRJLufaKDXHufFFS1y+TsBFh 0rPrCLxJlGiFepJdTF+vmV1ccexlmOe4+gO9QyNCNEHJ+x38cTLy1D/j+EZyI60AsIn0 x0m+JXRiZrdwe2Uz0JvECTebVUsMvMwpeJ2Jpm/SUGX5lInA8DcVKyX6aHtMRvk5D+m/ W7lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vBajxy6G; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12si1584689pgh.368.2019.01.30.08.00.56; Wed, 30 Jan 2019 08:01:13 -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; dkim=pass header.i=@kernel.org header.s=default header.b=vBajxy6G; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731667AbfA3P7D (ORCPT + 99 others); Wed, 30 Jan 2019 10:59:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:46420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730868AbfA3P7D (ORCPT ); Wed, 30 Jan 2019 10:59:03 -0500 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5B4FC207E0; Wed, 30 Jan 2019 15:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548863942; bh=sWdaExTiKujbd8IQNRc7yOGDcun7jZXiCntXA8mOtJE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vBajxy6GsV28qbzKmLhMEJZFwtFeXmnbdu4P6syzmfyY1OgxZoev0sY6iXvF8mx9+ Mpa34EYffI9U8KzGYStLDqczFYo47xutzziTS9AVHkHfg+r8eIhobw818xuzEbO+Mk ydEiKzz3fX3M2NaFPXS0Eizq6OOu/MmdMGfDTbVA= Date: Wed, 30 Jan 2019 09:58:53 -0600 From: Bjorn Helgaas To: Lorenzo Pieralisi Cc: honghui.zhang@mediatek.com, youlin.pei@mediatek.com, ryder.lee@mediatek.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, jianjun.wang@mediatek.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] PCI: Mediatek: Use resource_size function on resource object Message-ID: <20190130155853.GE229773@google.com> References: <1546409033-20412-1-git-send-email-honghui.zhang@mediatek.com> <20190130123347.GB30991@e107981-ln.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190130123347.GB30991@e107981-ln.cambridge.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 30, 2019 at 12:33:47PM +0000, Lorenzo Pieralisi wrote: > 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 didn't actually run checkpatch myself, so I don't know why it complained. The patch you merged moves "mem_size = resource_size(mem)" higher up, away from the previous location and its use, which makes it a little harder to read. Bjorn