Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp12378957imu; Tue, 1 Jan 2019 22:24:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN5FVvEl6yS1uX0M0aKZufZ118ksIJ7FWYPG9C1i4Mqst4ShAfTYxWM4nty4antNwVvC/Bbb X-Received: by 2002:a63:5518:: with SMTP id j24mr12319616pgb.208.1546410277858; Tue, 01 Jan 2019 22:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546410277; cv=none; d=google.com; s=arc-20160816; b=MGQ5dqHx/odqHXDdl3VLEMuiQmA8+uKquFOJzzfwt4Rgh0YUUU+PrnB9j4eRUCesvQ cj60ny/fNphOBp+E/ZdtY01NB7STHLwQek98Wu61M+mVR37bGZBmrZqzgbajnFAsHw2w /PiKL2dH7SLbiKsEfc2VS7cWreA4AVmX472dayKOxWyC/QYjhXeKnU67wZ53ADzGsBVF /J9HGqiqfJAc4xmFAAQGWXyKF4FFS2J8rQTxrMvnAIWaCVkSIFABUVqey09bMAiYMUnx DoPjV24RgMa3vcygi2S4C9k7ajn6RZSsE0qQtIGXzOGWgYLE4vUJ335VKEa5j/Fvjr9f rxXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=xQAT2Wwj5Xv4jiLCxK3Rv4+hz58J0ziuzgX30iyVYto=; b=sevh02tWWUDtUmYGOetaSdED7IUE6DY3BepLxKxw/Fq2F3ZHXvoiGjfWAtipCFzcxa tlmfaOCyhcngbRI929AetD/vEtYAdchWVgNqDHXbhJW1tIX7wBXtU+pecF0t0XN6en8m iBTsOXI9pEwTjlKE5cCJi+y7so0rbndWI2ZNqzudTP8r04xgk6ufbGhKuiA1EJeEj1yM c/FmQtojDVMjnfuUWswHjlfiYyrDfm2HVoxWBWT7mvr4FLKUMY3HaYIe2WMWfXrQtxfp Tb/v2fMajIfkGc8uK49RiAQLv0SrEVRB1ofR2Ik+ELo463+ZgcyevzsnxUE9VRc8Hi4j tBsA== 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 b24si47429284pgi.308.2019.01.01.22.24.23; Tue, 01 Jan 2019 22:24:37 -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 S1727928AbfABGEJ (ORCPT + 99 others); Wed, 2 Jan 2019 01:04:09 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:6017 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727360AbfABGEJ (ORCPT ); Wed, 2 Jan 2019 01:04:09 -0500 X-UUID: 23eadf837a9b47388a0b368ad424e620-20190102 X-UUID: 23eadf837a9b47388a0b368ad424e620-20190102 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 123869111; Wed, 02 Jan 2019 14:03:58 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 2 Jan 2019 14:03:56 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 2 Jan 2019 14:03:56 +0800 From: To: , , , , , , CC: , , Honghui Zhang Subject: [PATCH] PCI: Mediatek: Use resource_size function on resource object Date: Wed, 2 Jan 2019 14:03:53 +0800 Message-ID: <1546409033-20412-1-git-send-email-honghui.zhang@mediatek.com> X-Mailer: git-send-email 2.6.4 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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))); writel(val, port->base + PCIE_AHB_TRANS_BASE0_L); val = upper_32_bits(mem->start); -- 2.6.4