resources: tidy __request_region()
No functional change. Just return NULL for kzalloc failure immediately, rather than wrapping the whole function body in the body of an "if". Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
923f7f6970
commit
c26ec88ea8
|
@ -630,33 +630,34 @@ struct resource * __request_region(struct resource *parent,
|
||||||
{
|
{
|
||||||
struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
|
struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
|
||||||
|
|
||||||
if (res) {
|
if (!res)
|
||||||
res->name = name;
|
return NULL;
|
||||||
res->start = start;
|
|
||||||
res->end = start + n - 1;
|
|
||||||
res->flags = IORESOURCE_BUSY;
|
|
||||||
|
|
||||||
write_lock(&resource_lock);
|
res->name = name;
|
||||||
|
res->start = start;
|
||||||
|
res->end = start + n - 1;
|
||||||
|
res->flags = IORESOURCE_BUSY;
|
||||||
|
|
||||||
for (;;) {
|
write_lock(&resource_lock);
|
||||||
struct resource *conflict;
|
|
||||||
|
|
||||||
conflict = __request_resource(parent, res);
|
for (;;) {
|
||||||
if (!conflict)
|
struct resource *conflict;
|
||||||
break;
|
|
||||||
if (conflict != parent) {
|
|
||||||
parent = conflict;
|
|
||||||
if (!(conflict->flags & IORESOURCE_BUSY))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Uhhuh, that didn't work out.. */
|
conflict = __request_resource(parent, res);
|
||||||
kfree(res);
|
if (!conflict)
|
||||||
res = NULL;
|
|
||||||
break;
|
break;
|
||||||
|
if (conflict != parent) {
|
||||||
|
parent = conflict;
|
||||||
|
if (!(conflict->flags & IORESOURCE_BUSY))
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
write_unlock(&resource_lock);
|
|
||||||
|
/* Uhhuh, that didn't work out.. */
|
||||||
|
kfree(res);
|
||||||
|
res = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
write_unlock(&resource_lock);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__request_region);
|
EXPORT_SYMBOL(__request_region);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user