From patchwork Wed Jan 7 01:54:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 425894 X-Patchwork-Delegate: jagannadh.teki@gmail.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 48F09140077 for ; Wed, 7 Jan 2015 12:55:14 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 172784B601; Wed, 7 Jan 2015 02:55:10 +0100 (CET) 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 y48Mrxajr91C; Wed, 7 Jan 2015 02:55:09 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7A65A4B5EC; Wed, 7 Jan 2015 02:55:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DBE584B5EC for ; Wed, 7 Jan 2015 02:55:05 +0100 (CET) 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 T9OjxD-unjsB for ; Wed, 7 Jan 2015 02:55:05 +0100 (CET) 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 mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by theia.denx.de (Postfix) with ESMTPS id 66D5F4B5EB for ; Wed, 7 Jan 2015 02:55:02 +0100 (CET) Received: by mail-pd0-f181.google.com with SMTP id v10so1389855pde.12 for ; Tue, 06 Jan 2015 17:55:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=s5fjoFFn5v4N25KvO+QvE/BY490jEPVywhc/GSPCK/c=; b=I+V/7P3mtwFzo3q03cDWoMxr8fg5jh39s2KkwzIwk+ALA+GBH6tGa/5WBRmf+aneuW 0xT82ACgVAjGrZ5ncsHWQ7dEudhzqBgzxRXg0OdCQ/FTiUHelYk51XUr6lXn5ukxvMYP rpaMfZP1jACBYtx11+pS0t1W5U7gEvu3q17wsRry/1N2SGKGeQGvMBOQUgM1f4Ejoj5J 09aJCOWmoHJuN7ShqEVJRAU0YvQHAQedMre+yAVeIExHsveNP1CNBwR2W9H8p2cZ3PEC CNXO6PL6C/aq907DoHnbXE92vnMclL0AxyYo+LoCrjYuiqcriBMJLOprifwdL5bMS7mQ 6xjQ== X-Gm-Message-State: ALoCoQn4NFEfGNBPZ2gki6Ck3PqWaO0ct2+nRD2B/+FcQFlccBGuZeHyuKoZ/Lx33cIx4oyjfgJX X-Received: by 10.66.249.226 with SMTP id yx2mr752440pac.112.1420595700091; Tue, 06 Jan 2015 17:55:00 -0800 (PST) Received: from [192.168.0.104] (218-164-103-100.dynamic.hinet.net. [218.164.103.100]) by mx.google.com with ESMTPSA id y3sm138544pbt.44.2015.01.06.17.54.58 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 06 Jan 2015 17:54:59 -0800 (PST) Message-ID: <1420595696.9538.1.camel@phoenix> From: Axel Lin To: U-Boot Mailing List Date: Wed, 07 Jan 2015 09:54:56 +0800 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Cc: Stefan Roese Subject: [U-Boot] [PATCH] spi: cadence_qspi: Fix checking return value of fdt_first_subnode() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de fdt_first_subnode() returns -FDT_ERR_NOTFOUND if no subnode found. 0 is supposed to be a valid offset returns from fdt_first_subnode(). Signed-off-by: Axel Lin --- drivers/spi/cadence_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c index fa95b19..98ae3b8 100644 --- a/drivers/spi/cadence_qspi.c +++ b/drivers/spi/cadence_qspi.c @@ -297,7 +297,7 @@ static int cadence_spi_ofdata_to_platdata(struct udevice *bus) /* All other paramters are embedded in the child node */ subnode = fdt_first_subnode(blob, node); - if (!subnode) { + if (subnode < 0) { printf("Error: subnode with SPI flash config missing!\n"); return -ENODEV; }