diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-10-16 01:05:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:51 -0400 |
commit | c26ec88ea86ad5122a6ea5ad635e6a1f6c395d74 (patch) | |
tree | 8e7e95851dc24327fbdb05c90b2eb0b40f60cadc /kernel | |
parent | 923f7f6970bd448b8e88b9e4be10fd01fc7106a4 (diff) |
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/resource.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 414d6fc9131e..f193d6e3ded2 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -630,33 +630,34 @@ struct resource * __request_region(struct resource *parent, | |||
630 | { | 630 | { |
631 | struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); | 631 | struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); |
632 | 632 | ||
633 | if (res) { | 633 | if (!res) |
634 | res->name = name; | 634 | return NULL; |
635 | res->start = start; | ||
636 | res->end = start + n - 1; | ||
637 | res->flags = IORESOURCE_BUSY; | ||
638 | 635 | ||
639 | write_lock(&resource_lock); | 636 | res->name = name; |
637 | res->start = start; | ||
638 | res->end = start + n - 1; | ||
639 | res->flags = IORESOURCE_BUSY; | ||
640 | 640 | ||
641 | for (;;) { | 641 | write_lock(&resource_lock); |
642 | struct resource *conflict; | ||
643 | 642 | ||
644 | conflict = __request_resource(parent, res); | 643 | for (;;) { |
645 | if (!conflict) | 644 | struct resource *conflict; |
646 | break; | ||
647 | if (conflict != parent) { | ||
648 | parent = conflict; | ||
649 | if (!(conflict->flags & IORESOURCE_BUSY)) | ||
650 | continue; | ||
651 | } | ||
652 | 645 | ||
653 | /* Uhhuh, that didn't work out.. */ | 646 | conflict = __request_resource(parent, res); |
654 | kfree(res); | 647 | if (!conflict) |
655 | res = NULL; | ||
656 | break; | 648 | break; |
649 | if (conflict != parent) { | ||
650 | parent = conflict; | ||
651 | if (!(conflict->flags & IORESOURCE_BUSY)) | ||
652 | continue; | ||
657 | } | 653 | } |
658 | write_unlock(&resource_lock); | 654 | |
655 | /* Uhhuh, that didn't work out.. */ | ||
656 | kfree(res); | ||
657 | res = NULL; | ||
658 | break; | ||
659 | } | 659 | } |
660 | write_unlock(&resource_lock); | ||
660 | return res; | 661 | return res; |
661 | } | 662 | } |
662 | EXPORT_SYMBOL(__request_region); | 663 | EXPORT_SYMBOL(__request_region); |