diff mbox

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

Message ID BLU436-SMTP170706B6EA27FA70C0C6CC2BFC20@phx.gbl
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng May 20, 2015, 7:55 a.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>
---

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

Comments

Simon Glass May 20, 2015, 10:20 p.m. UTC | #1
On 20 May 2015 at 01:55, 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>
> ---
>
>  arch/x86/cpu/irq.c | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>

>
> diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
> index 32dc6f2..ce6334b 100644
> --- a/arch/x86/cpu/irq.c
> +++ b/arch/x86/cpu/irq.c
> @@ -217,5 +217,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);
>  }
> --
> 1.8.2.1
>
diff mbox

Patch

diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index 32dc6f2..ce6334b 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -217,5 +217,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);
 }