diff mbox

[U-Boot] powerpc/mpc85xx: Don't deref NULL if qman portal lacks cell-index

Message ID 1429312206-27312-1-git-send-email-scottwood@freescale.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

Scott Wood April 17, 2015, 11:10 p.m. UTC
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/portals.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

York Sun May 5, 2015, 4:36 p.m. UTC | #1
On 04/17/2015 04:10 PM, Scott Wood wrote:
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> Cc: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
> ---

Applied to u-boot-mpc85xx master. Awaiting upstream.

York
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c b/arch/powerpc/cpu/mpc85xx/portals.c
index ec3b292..3777c6f 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -249,8 +249,13 @@  void fdt_fixup_qportals(void *blob)
 #ifdef CONFIG_FSL_CORENET
 		u32 liodns[2];
 #endif
-		const int *ci = fdt_getprop(blob, off, "cell-index", NULL);
-		int i = *ci;
+		const int *ci = fdt_getprop(blob, off, "cell-index", &err);
+		int i;
+
+		if (!ci)
+			goto err;
+
+		i = *ci;
 #ifdef CONFIG_SYS_DPAA_FMAN
 		int j;
 #endif