lkml.org 
[lkml]   [2023]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] arm: match-footbridge: Add error handling in dc21285_setup()
Date
This patch adds error-handling for the allocate_resource()
inside the dc21285_setup().

Signed-off-by: liuhaoran <liuhaoran14@163.com>
---
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;

--
2.17.1
\
 
 \ /
  Last update: 2023-09-23 18:05    [W:0.369 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site