resource: Let __request_region return an error pointer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
a00e634ac6
commit
82ed205466
|
@ -22,6 +22,7 @@
|
|||
#include <of.h>
|
||||
#include <init.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/err.h>
|
||||
#include <asm-generic/memory_layout.h>
|
||||
#include <asm/sections.h>
|
||||
#include <malloc.h>
|
||||
|
@ -150,7 +151,7 @@ struct resource *request_sdram_region(const char *name, resource_size_t start,
|
|||
|
||||
res = __request_region(bank->res, name, start,
|
||||
start + size - 1);
|
||||
if (res)
|
||||
if (!IS_ERR(res))
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <errno.h>
|
||||
#include <init.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/err.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
static int init_resource(struct resource *res, const char *name)
|
||||
|
@ -48,7 +49,7 @@ struct resource *__request_region(struct resource *parent,
|
|||
__func__,
|
||||
(unsigned long long)start,
|
||||
(unsigned long long)end);
|
||||
return NULL;
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
/* outside parent resource? */
|
||||
|
@ -59,7 +60,7 @@ struct resource *__request_region(struct resource *parent,
|
|||
(unsigned long long)end,
|
||||
(unsigned long long)parent->start,
|
||||
(unsigned long long)parent->end);
|
||||
return NULL;
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -77,7 +78,7 @@ struct resource *__request_region(struct resource *parent,
|
|||
(unsigned long long)end,
|
||||
(unsigned long long)r->start,
|
||||
(unsigned long long)r->end);
|
||||
return NULL;
|
||||
return ERR_PTR(-EBUSY);
|
||||
}
|
||||
|
||||
ok:
|
||||
|
@ -124,7 +125,13 @@ struct resource iomem_resource = {
|
|||
struct resource *request_iomem_region(const char *name,
|
||||
resource_size_t start, resource_size_t end)
|
||||
{
|
||||
return __request_region(&iomem_resource, name, start, end);
|
||||
struct resource *res;
|
||||
|
||||
res = __request_region(&iomem_resource, name, start, end);
|
||||
if (IS_ERR(res))
|
||||
return NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* The root resource for the whole io-mapped io space */
|
||||
|
@ -141,5 +148,11 @@ struct resource ioport_resource = {
|
|||
struct resource *request_ioport_region(const char *name,
|
||||
resource_size_t start, resource_size_t end)
|
||||
{
|
||||
return __request_region(&ioport_resource, name, start, end);
|
||||
struct resource *res;
|
||||
|
||||
res = __request_region(&ioport_resource, name, start, end);
|
||||
if (IS_ERR(res))
|
||||
return NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue