diff mbox

[U-Boot,v2,4/4] x86: Do sanity test on pirq table before writing

Message ID BLU437-SMTP81EA1D5B797A7527EA7BC0BFCD0@phx.gbl
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng May 25, 2015, 2:35 p.m. UTC
If pirq_routing_table points to NULL, that means U-Boot fails to
generate the table before in create_pirq_routing_table(), so we
test it against NULL before actually writing it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/x86/cpu/irq.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass June 2, 2015, 2:19 p.m. UTC | #1
On 25 May 2015 at 08:35, Bin Meng <bmeng.cn@gmail.com> wrote:
> If pirq_routing_table points to NULL, that means U-Boot fails to
> generate the table before in create_pirq_routing_table(), so we
> test it against NULL before actually writing it.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  arch/x86/cpu/irq.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index d1711af..74b89ad 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -209,5 +209,8 @@  void pirq_init(void)
 
 u32 write_pirq_routing_table(u32 addr)
 {
+	if (!pirq_routing_table)
+		return addr;
+
 	return copy_pirq_routing_table(addr, pirq_routing_table);
 }