From patchwork Fri Apr 17 23:10:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 462221 X-Patchwork-Delegate: yorksun@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BE8CE140283 for ; Sat, 18 Apr 2015 09:10:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 45CD43932; Sat, 18 Apr 2015 01:10:25 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uM6bPGZnFVJa; Sat, 18 Apr 2015 01:10:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C2ACAA7436; Sat, 18 Apr 2015 01:10:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DE348A7436 for ; Sat, 18 Apr 2015 01:10:21 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HGwFzxVVDc1e for ; Sat, 18 Apr 2015 01:10:21 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0102.outbound.protection.outlook.com [65.55.169.102]) by theia.denx.de (Postfix) with ESMTPS id 81779A7431 for ; Sat, 18 Apr 2015 01:10:16 +0200 (CEST) Received: from BN3PR03MB1477.namprd03.prod.outlook.com (0.163.35.140) by BN3PR03MB1381.namprd03.prod.outlook.com (0.163.34.155) with Microsoft SMTP Server (TLS) id 15.1.136.25; Fri, 17 Apr 2015 23:10:15 +0000 Authentication-Results: freescale.com; dkim=none (message not signed) header.d=none; Received: from snotra.am.freescale.net (192.88.168.49) by BN3PR03MB1477.namprd03.prod.outlook.com (0.163.35.140) with Microsoft SMTP Server (TLS) id 15.1.136.25; Fri, 17 Apr 2015 23:10:13 +0000 From: Scott Wood To: Date: Fri, 17 Apr 2015 18:10:06 -0500 Message-ID: <1429312206-27312-1-git-send-email-scottwood@freescale.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 X-Originating-IP: [192.88.168.49] X-ClientProxiedBy: SN1PR07CA0022.namprd07.prod.outlook.com (25.162.170.160) To BN3PR03MB1477.namprd03.prod.outlook.com (25.163.35.140) X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1477; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1381; X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(62966003)(40100003)(229853001)(50986999)(77156002)(450100001)(2371004)(86362001)(110136001)(42186005)(19580405001)(19580395003)(122386002)(33646002)(87976001)(50226001)(46102003)(50466002)(2351001)(66066001)(48376002)(36756003)(92566002)(47776003)(4001450100001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR03MB1477; H:snotra.am.freescale.net; FPR:; SPF:None; MLV:sfv; LANG:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002010)(5005006); SRVR:BN3PR03MB1477; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1477; X-Forefront-PRVS: 0549E6FD50 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2015 23:10:13.4367 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1477 X-OriginatorOrg: freescale.com Cc: Scott Wood , u-boot@lists.denx.de, Madalin-Cristian Bucur Subject: [U-Boot] [PATCH] powerpc/mpc85xx: Don't deref NULL if qman portal lacks cell-index X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Scott Wood Cc: Madalin-Cristian Bucur --- arch/powerpc/cpu/mpc85xx/portals.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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