From patchwork Fri Oct 9 13:36:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 528218 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 C65A1140D5F for ; Sat, 10 Oct 2015 00:36:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=1H/Vchtq; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A7FC14B74D; Fri, 9 Oct 2015 15:36:10 +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 xtk6la9aKdfM; Fri, 9 Oct 2015 15:36:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F20C4B6CB; Fri, 9 Oct 2015 15:36:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BB5A84B6CB for ; Fri, 9 Oct 2015 15:36:06 +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 2CNzRKvQnHAa for ; Fri, 9 Oct 2015 15:36:06 +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-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) by theia.denx.de (Postfix) with ESMTPS id 417864B6A8 for ; Fri, 9 Oct 2015 15:36:01 +0200 (CEST) Received: by igkz10 with SMTP id z10so1359941igk.1 for ; Fri, 09 Oct 2015 06:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=einYOWGn5jIXoZkvDCwyk7n8YNAlMaSJRzFbWP+R10I=; b=1H/Vchtq8F508J2PM5tsqqWUHDYNpmweo5EsrjYYrxI6t7BJyCg00rQ6kjSZy0tLqI VjX2mKVkPUfzf7rkMTuH6UWDyguPqi7zosxGMalHQOZWNBHCK0qcRxDf44MwdZslXUUy ANWa79gaY7SRUQhjfHNNPrS2PgJRoMbT6w6BCRN8RFAy0UxWgHQdD0QlKVJyWyPPaFjc iNT4Rhv328CzEJAsAwFTcYRl4G/ALw7Oy9di9uIeYsd5ynQNIpXsry1LLptcVrGAzi/0 gXH57F9t7O2YZ4im1E/07O9cjOCShV50i7S6PMtaB1pdAIC9p3TvdcBZGHcr5zr5spzj w4ng== MIME-Version: 1.0 X-Received: by 10.50.138.73 with SMTP id qo9mr10246103igb.28.1444397760801; Fri, 09 Oct 2015 06:36:00 -0700 (PDT) Received: by 10.79.1.42 with HTTP; Fri, 9 Oct 2015 06:36:00 -0700 (PDT) In-Reply-To: References: <1444261051-5468-1-git-send-email-festevam@gmail.com> Date: Fri, 9 Oct 2015 10:36:00 -0300 Message-ID: From: Fabio Estevam To: Simon Glass Cc: Fabio Estevam , Tom Rini , U-Boot Mailing List Subject: Re: [U-Boot] [PATCH] cmd_pci: Check for VendorID earlier 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" On Fri, Oct 9, 2015 at 10:31 AM, Simon Glass wrote: > If you look down one more level, these end up calling > imx_pcie_read_config() which calls imx_pcie_addr_valid(): > > static int imx_pcie_addr_valid(pci_dev_t d) > { > if ((PCI_BUS(d) == 0) && (PCI_DEV(d) > 1)) > return -EINVAL; > if ((PCI_BUS(d) == 1) && (PCI_DEV(d) > 0)) > return -EINVAL; > return 0; > } > > I can understand the bus check, but why return an access error if the > device does not exist on the bus? That seems like a bug to me. Is your suggestion like this? Regards, Fabio Estevam --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -67,7 +67,7 @@ int pci_hose_read_config_##size##_via_dword(struct pci_control \ if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0) { *val = -1; \ - return -1; \ + return 0; \ } \ \ *val = (val32 >> ((offset & (int)off_mask) * 8));