From patchwork Thu Aug 20 09:18:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 265842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A41BC433E1 for ; Thu, 20 Aug 2020 09:36:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BB0F20724 for ; Thu, 20 Aug 2020 09:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916160; bh=+Nv6csKMBWGiy1e80R3z4GTu13tZAaLYToez1KLYUvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hxIzuM3ZkOMpnOLa+/0UPuf3+zND8T9Ir1rmcy1TXRY1G9DnY4STXgLkiLHyNN7zO Tj+q0GaPuKnfHPBevgywhFTZITt+D87om92+d469ysJ8YzQWW7e27bN/flviM392Dd HGQ70gX1AgFgKa0T7qGLRH6WKl9VE3P6Ct5HCmYs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728548AbgHTJf6 (ORCPT ); Thu, 20 Aug 2020 05:35:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:49974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728414AbgHTJfy (ORCPT ); Thu, 20 Aug 2020 05:35:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA51122B49; Thu, 20 Aug 2020 09:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916154; bh=+Nv6csKMBWGiy1e80R3z4GTu13tZAaLYToez1KLYUvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7KI4kfiwhxHz9Gmwg58qAysUM0py0JBy+B9ZhBbQduMKTofUgwVMBL/PAATmkWaC Eurl4M3JZSWAL4/pthJUkwO3hv23RV0l4/8htO+uM1FeD7noKGI3jgEsacZFa+6JbD hI85AqEVC838B+iEhConM5EF9Kwqf9cRYvZ+f71Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rajat Jain , Bjorn Helgaas Subject: [PATCH 5.7 007/204] PCI: Add device even if driver attach failed Date: Thu, 20 Aug 2020 11:18:24 +0200 Message-Id: <20200820091606.567342367@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091606.194320503@linuxfoundation.org> References: <20200820091606.194320503@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rajat Jain commit 2194bc7c39610be7cabe7456c5f63a570604f015 upstream. device_attach() returning failure indicates a driver error while trying to probe the device. In such a scenario, the PCI device should still be added in the system and be visible to the user. When device_attach() fails, merely warn about it and keep the PCI device in the system. This partially reverts ab1a187bba5c ("PCI: Check device_attach() return value always"). Link: https://lore.kernel.org/r/20200706233240.3245512-1-rajatja@google.com Signed-off-by: Rajat Jain Signed-off-by: Bjorn Helgaas Reviewed-by: Greg Kroah-Hartman Cc: stable@vger.kernel.org # v4.6+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/bus.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -322,12 +322,8 @@ void pci_bus_add_device(struct pci_dev * dev->match_driver = true; retval = device_attach(&dev->dev); - if (retval < 0 && retval != -EPROBE_DEFER) { + if (retval < 0 && retval != -EPROBE_DEFER) pci_warn(dev, "device attach failed (%d)\n", retval); - pci_proc_detach_device(dev); - pci_remove_sysfs_dev_files(dev); - return; - } pci_dev_assign_added(dev, true); }