From patchwork Mon Jul 15 14:57:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 2827570 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 38B739F7D6 for ; Mon, 15 Jul 2013 14:58:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A414C2020F for ; Mon, 15 Jul 2013 14:57:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7FFA5201F7 for ; Mon, 15 Jul 2013 14:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757787Ab3GOO5z (ORCPT ); Mon, 15 Jul 2013 10:57:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12505 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757764Ab3GOO5y (ORCPT ); Mon, 15 Jul 2013 10:57:54 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6FEvhIt020810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 15 Jul 2013 10:57:44 -0400 Received: from prarit.bos.redhat.com ([10.18.17.119]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r6FEvgYY027461; Mon, 15 Jul 2013 10:57:42 -0400 From: Prarit Bhargava To: linux-acpi@vger.kernel.org Cc: Prarit Bhargava , Len Brown , "Rafael J. Wysocki" , "Bjorn Helgaas" , "Myron Stowe" , linux-pci@vger.kernel.org Subject: [PATCH] acpi, acpi_pci_irq_enable must return an error if ACPI cannot map an IRQ. Date: Mon, 15 Jul 2013 10:57:40 -0400 Message-Id: <1373900260-1599-1-git-send-email-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver probe's currently do the following pci_enable_device(); /* ... do some other init stuff, and eventually call ... */ request_irq(); After pci_enable_device() is called it is assumed that the device's irq value (pci_dev->irq) has been appropriately set on success. This value is passed into the request_irq() call. In the case that ACPI is used to determine the irq value, it is possible that the ACPI IRQ look up for a specific device fails and success is returned by pci_enable_device(). The call sequence is: pci_enable_device(); -> pci_enable_device_flags(); ->do_pci_enable_device(); -> pcibios_enable_device() which, if the device does not use MSI calls -> pcibios_enable_irq() which maps to acpi_pci_irq_enable() -> acpi_pci_irq_lookup() If acpi_pci_irq_lookup() cannot map the device's IRQ value it returns NULL as an error. The error is returned to acpi_pci_irq_enable(), but is not propagated further. This can result in the driver returning success for pci_enable_device() and the driver probe attempting to call request_irq() with dev->irq = 0. This patch modifies acpi_pci_irq_enable() to return an error in the case that an entry is not found in the ACPI tables. Signed-off-by: Prarit Bhargava Cc: Len Brown Cc: "Rafael J. Wysocki" Cc: "Bjorn Helgaas" Cc: "Myron Stowe" Cc: linux-pci@vger.kernel.org --- drivers/acpi/pci_irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 41c5e1b..9681847 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -430,6 +430,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) } else { dev_warn(&dev->dev, "PCI INT %c: no GSI\n", pin_name(pin)); + return -ENOENT; } return 0;