From patchwork Sat Sep 23 16:03:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haoran Liu X-Patchwork-Id: 13396843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6D2ACE7A89 for ; Sat, 23 Sep 2023 16:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=FsU6434UqEkBjSLtasmGOmffP4GKFyT7781qH+PqjEk=; b=mX0m+r3csSIm1h /K4h7inRvkxUt6KIVx7IvfZrZ1ISfBORJs01WM81B32hbOY6HP0nnqYpqvHF0tZg7NI4zzgwN/QnV hu9JQ4bLL70F4dUGjM/g42wnFCBGIg1BrFTJZrjYvo+ty5efeCIx+Y/GFBlKqsHUqYOukUpKXjif2 6B52d9Y6E3qno2QhSAmbZTwexBQApgeBn623ZNtR7yXP9Dt46+O6bJfwQFnEKlupjKs5/WpqBn/ml Jwf1UB3Br1nOGf/ytwHcWpD3SHQlB6KpUdcHtuMVViL1+6bXNNToYZCTurQeX2uA5cliTbCQtW4aj k/ybk3xbMhafsf/lffrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qk5MA-00BBnb-0B; Sat, 23 Sep 2023 16:19:46 +0000 Received: from m15.mail.163.com ([45.254.50.219]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qk5M6-00BBmE-1R for linux-arm-kernel@lists.infradead.org; Sat, 23 Sep 2023 16:19:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=hrRrRt8WsW3sIAoTAf qtyDId6QcDAcmE+7CIhdxf4T8=; b=PKHal8FOw1c6LoA0bk2DG7cA6aIrbS+vM+ qy2kGVfUnRc7Z3s9aWGeFFHgEfyBr3fEKWDDF2xrcW6JMZYamThhwwPMnRw8XsIW 7jdesJaZm/00ALD1cxgVzO0bxBVa2iie7XNgQP3gtyCgwV0XYG2s5fM/tQaJdoCX A6MLJA+zI= Received: from localhost.localdomain (unknown [223.104.131.178]) by zwqz-smtp-mta-g2-3 (Coremail) with SMTP id _____wAXpmp1DA9lhkCkCw--.52707S2; Sun, 24 Sep 2023 00:04:07 +0800 (CST) From: liuhaoran To: linux@armlinux.org.uk Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, liuhaoran Subject: [PATCH] arm: match-footbridge: Add error handling in dc21285_setup() Date: Sun, 24 Sep 2023 00:03:53 +0800 Message-Id: <20230923160353.42915-1-liuhaoran14@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wAXpmp1DA9lhkCkCw--.52707S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJr1UGrykAF13Jr17uryUZFb_yoW8XrWkpr 1xCws0krsYgr1UCrsxJr1UZFWfZ3Z2yFW3CrWxt3sFv3WkJFWqgFs0y3s09w45tr1DAw1f tF1kAF40qF1DGaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UrPEgUUUUU= X-Originating-IP: [223.104.131.178] X-CM-SenderInfo: xolxxtxrud0iqu6rljoofrz/1tbibBjzgmNfuLQqtQAAsq X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230923_091942_950580_03ED7905 X-CRM114-Status: GOOD ( 12.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch adds error-handling for the allocate_resource() inside the dc21285_setup(). Signed-off-by: liuhaoran --- arch/arm/mach-footbridge/dc21285.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c index f8920d0010de..1970c66eb964 100644 --- a/arch/arm/mach-footbridge/dc21285.c +++ b/arch/arm/mach-footbridge/dc21285.c @@ -261,6 +261,7 @@ static struct notifier_block dc21285_pci_bus_nb = { int __init dc21285_setup(int nr, struct pci_sys_data *sys) { struct resource *res; + int error; res = kcalloc(2, sizeof(struct resource), GFP_KERNEL); if (!res) { @@ -273,10 +274,21 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys) res[1].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; res[1].name = "Footbridge prefetch"; - allocate_resource(&iomem_resource, &res[1], 0x20000000, + error = allocate_resource(&iomem_resource, &res[1], 0x20000000, 0xa0000000, 0xffffffff, 0x20000000, NULL, NULL); + if (error < 0) { + printk(KERN_ERR "%s: allocate_resource failed %d!" + , __func__, error); + return 0; + } + allocate_resource(&iomem_resource, &res[0], 0x40000000, 0x80000000, 0xffffffff, 0x40000000, NULL, NULL); + if (error < 0) { + printk(KERN_ERR "%s: allocate_resource failed %d!" + , __func__, error); + return 0; + } sys->mem_offset = DC21285_PCI_MEM;