From patchwork Thu Aug 13 02:09:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 506809 X-Patchwork-Delegate: sjg@chromium.org 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 211D91401B5 for ; Thu, 13 Aug 2015 12:10:19 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=nl34diuI; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E6AE14B681; Thu, 13 Aug 2015 04:10:14 +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 zljrKl9j3Sjt; Thu, 13 Aug 2015 04:10:14 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D10CB4B676; Thu, 13 Aug 2015 04:10:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DA9AE4B65F for ; Thu, 13 Aug 2015 04:10:09 +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 iQowPwlTY-LZ for ; Thu, 13 Aug 2015 04:10:09 +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 mail-ig0-f169.google.com (mail-ig0-f169.google.com [209.85.213.169]) by theia.denx.de (Postfix) with ESMTPS id 75A974B65D for ; Thu, 13 Aug 2015 04:10:05 +0200 (CEST) Received: by igbpg9 with SMTP id pg9so124421826igb.0 for ; Wed, 12 Aug 2015 19:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=o2+oD9fSM38SWZbSEGLLxQPXV6q6wMnYImbeGnGvCTc=; b=nl34diuIj74O9RD1Qa/60o32frL3cD3az3gHT+a0Zhj6gLdqLrzclqDd5XzfXuusKx bkpI9j4CSVlkHFTtRGfeT2JZyZo0HVk83oQ1BN/3istPGzME0NbAzhnjvduqb+U/hhPh 2THcuj60qJr0Q657WM9mkkquvBhmT6hK7u/53f375wf8/aIoUSp9Yj7zjcCJNrekiwKl OyjIB87SRkmTAiEFrWSQHhyuvzzrO3/jDiC3Xjhre5uA/kfydWje78FM9vE8Es1o5gsk YZxdsVYTn3YPRtfHwYzFbopZ8/hJyvSSdhwPabnQAQfC5Dk7HUeXtszf6kQCAbQ2rvJZ FvFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=o2+oD9fSM38SWZbSEGLLxQPXV6q6wMnYImbeGnGvCTc=; b=i2ztHILAdkrGWzmK+ML0sLHVVZlEQ5EJ+UsGxE6yuH0nf4ztlq/3RVTdy79/FnpRS6 gcvOtPTwdP14UAczBAyHLk26jbep9cOO4mm3uMor9ItdrrTu/pfRQr98R6bn0kxP1SUL DLGepquqEGfrikstN9YJrzjs8YtqoBBsGG86vqtZhNGpWYQs+eYEZVga3wp+1fOO+f8q wFsbf4LbCg3jhwrLEB8zEWHam93kKgg74000mUBd/5uL89JNQ9oPGJAezpr45bKmCKYZ HCwWxNHkLTXikeiTwQnKvWxxdIw1HtKLd1hT5UF6WQv3gS0ipC/IUb0YXNHGtcr59ePR 1gyA== X-Gm-Message-State: ALoCoQl2jcgQTo8u+rOM8P6UDbX5pbkba0q7yUEpTX9p9SdvyZPcsvP+T15uwicxh0zlTu3Ca6kE X-Received: by 10.50.30.196 with SMTP id u4mr763824igh.11.1439431804397; Wed, 12 Aug 2015 19:10:04 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id f83sm563046iod.19.2015.08.12.19.10.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Aug 2015 19:10:03 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 07B44220B70; Wed, 12 Aug 2015 20:10:02 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 12 Aug 2015 20:09:30 -0600 Message-Id: <1439431779-16857-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.5.0.276.gf5e568e In-Reply-To: <1439431779-16857-1-git-send-email-sjg@chromium.org> References: <1439431779-16857-1-git-send-email-sjg@chromium.org> Cc: Graeme Russ , Tom Rini , Andrew Bradford Subject: [U-Boot] [PATCH 01/10] x86: Return -1 when reading a PCI config register fails 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This can fail for internal reasons, so return a sensible value rather than a random one. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/pci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c index f8da080..d2ec45a 100644 --- a/arch/x86/cpu/pci.c +++ b/arch/x86/cpu/pci.c @@ -76,7 +76,8 @@ unsigned int x86_pci_read_config8(pci_dev_t dev, unsigned where) { uint8_t value; - pci_hose_read_config_byte(get_hose(), dev, where, &value); + if (pci_hose_read_config_byte(get_hose(), dev, where, &value)) + return -1U; return value; } @@ -85,7 +86,8 @@ unsigned int x86_pci_read_config16(pci_dev_t dev, unsigned where) { uint16_t value; - pci_hose_read_config_word(get_hose(), dev, where, &value); + if (pci_hose_read_config_word(get_hose(), dev, where, &value)) + return -1U; return value; } @@ -94,7 +96,8 @@ unsigned int x86_pci_read_config32(pci_dev_t dev, unsigned where) { uint32_t value; - pci_hose_read_config_dword(get_hose(), dev, where, &value); + if (pci_hose_read_config_dword(get_hose(), dev, where, &value)) + return -1U; return value; }