[PATCH 3/7] x86: fix alloc_mptable

From: Yinghai Lu
Date: Wed May 06 2009 - 13:08:52 EST



fix the condition checking.

[ Impact: make alloc_mptable working ]

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
arch/x86/kernel/mpparse.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -873,21 +873,24 @@ inline void __init check_irq_src(struct
static int check_slot(unsigned long mpc_new_phys, unsigned long mpc_new_length,
int count)
{
+ int ret = 0;
+
if (!mpc_new_phys) {
- pr_info("No spare slots, try to append...take your risk, "
+ pr_warning("No spare slots, try to append...take your risk, "
"new mpc_length %x\n", count);
} else {
- if (count <= mpc_new_length)
+ if (count <= mpc_new_length) {
pr_info("No spare slots, try to append..., "
"new mpc_length %x\n", count);
- else {
+ ret = 1;
+ } else {
pr_err("mpc_new_length %lx is too small\n",
mpc_new_length);
- return -1;
+ ret = -1;
}
}

- return 0;
+ return ret;
}

static int __init replace_intsrc_all(struct mpc_table *mpc,
@@ -946,7 +949,7 @@ static int __init replace_intsrc_all(st
} else {
struct mpc_intsrc *m = (struct mpc_intsrc *)mpt;
count += sizeof(struct mpc_intsrc);
- if (!check_slot(mpc_new_phys, mpc_new_length, count))
+ if (check_slot(mpc_new_phys, mpc_new_length, count) < 0)
goto out;
assign_to_mpc_intsrc(&mp_irqs[i], m);
mpc->length = count;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/