Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffc43836 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar
Browse files

x86, ioapic: Get rid of needless check and simplify ioapic_setup_resources()



alloc_bootmem() already panics on allocation failure. There is
no need to check the result.

Also there is a way to unbind global variable from its body and
use it as a parameter which allow us to simplify
ioapic_init_mappings as well -- "for" cycle already uses
nr_ioapics as a conditional variable and there is no need to
check if ioapic_setup_resources was returning NULL again.

Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
Cc: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <20090824175551.493629148@openvz.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8f3e1df4
Loading
Loading
Loading
Loading
+11 −15
Original line number Diff line number Diff line
@@ -4053,7 +4053,7 @@ void __init setup_ioapic_dest(void)

static struct resource *ioapic_resources;

static struct resource * __init ioapic_setup_resources(void)
static struct resource * __init ioapic_setup_resources(int nr_ioapics)
{
	unsigned long n;
	struct resource *res;
@@ -4069,7 +4069,6 @@ static struct resource * __init ioapic_setup_resources(void)
	mem = alloc_bootmem(n);
	res = (void *)mem;

	if (mem != NULL) {
	mem += sizeof(struct resource) * nr_ioapics;

	for (i = 0; i < nr_ioapics; i++) {
@@ -4078,7 +4077,6 @@ static struct resource * __init ioapic_setup_resources(void)
		sprintf(mem,  "IOAPIC %u", i);
		mem += IOAPIC_RESOURCE_NAME_SIZE;
	}
	}

	ioapic_resources = res;

@@ -4091,7 +4089,7 @@ void __init ioapic_init_mappings(void)
	struct resource *ioapic_res;
	int i;

	ioapic_res = ioapic_setup_resources();
	ioapic_res = ioapic_setup_resources(nr_ioapics);
	for (i = 0; i < nr_ioapics; i++) {
		if (smp_found_config) {
			ioapic_phys = mp_ioapics[i].apicaddr;
@@ -4120,13 +4118,11 @@ void __init ioapic_init_mappings(void)
			    __fix_to_virt(idx), ioapic_phys);
		idx++;

		if (ioapic_res != NULL) {
		ioapic_res->start = ioapic_phys;
		ioapic_res->end = ioapic_phys + (4 * 1024) - 1;
		ioapic_res++;
	}
}
}

static int __init ioapic_insert_resources(void)
{