Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp560209ybt; Mon, 6 Jul 2020 16:35:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbVuwTp/F+ZzAgH0540pYZnEK8ayolHlYEsSpgaWbTLGWsNvDUqCDUnfvLGVQ9PgmxwrqM X-Received: by 2002:a17:906:e089:: with SMTP id gh9mr20970274ejb.482.1594078540020; Mon, 06 Jul 2020 16:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594078540; cv=none; d=google.com; s=arc-20160816; b=FGOTfIvVqCD6xXU41OqeYWiuNhcCt1dF5SF80K7fRmgaAmCKwtq+XZr4xz4M8VpfbG vppqE3T6HY/SIbP237agjfLO3LXU8kgHadUnZRN43tZbJM9r8RgEVmqFhfUBfC0fPSMA iODSD/dTA8ruocN+IzQ8AE94ACbxkL/1ffS8E4FODQEwj8q7JKFbvDPK7j8uSSIdSTP0 hCBI951yWEdbVAxqkwn4Z565l5drznv26uSvXnmGmoRBHJlYhhd93UJ37sIrpXX4RSNx yyW3baRroLtZJh2J15m804T+7BiB8Q90kI1RtV2kLVjJNj6Pr8mfMggng/IMV53NeWLU sj0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=4fIH4GN6n6dAxulY3f2rwIOekdlU8y7grvtSAmvPzI8=; b=UFlZjXr6boy7TomBurmUtAts5w/yPAL73TF3FlFsZstAcGMRa9Hwu+Zy/WgJQWeMOu p4wbKrPhYv4F8nlg/1fnYkHpJ+NR6KMFRc1zwL9ptyVibM6ohu7in+rt3/I8+6ND1oBU 5vTkvseHLQ7s5AgSruCt9mhaR77cSR2YSp2UV+wxm7qnIw41OAOIHuvCsdKybrCESpO9 Pj0H3sdRyw2XihOC1G/aW5rKM+rIkstmIdRWcHbyoqOHWhC/ycsEzqj1O+B31/ZXOMwf AKp7hwP6q1mb+FsPXdjOzC2K7pxTd24XB5R5DjzoS5VL9MHbDMbjqzDfbsCxSRWHy719 lseA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J9lTuX6B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si16046157edb.243.2020.07.06.16.35.07; Mon, 06 Jul 2020 16:35:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J9lTuX6B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbgGFXcq (ORCPT + 99 others); Mon, 6 Jul 2020 19:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726883AbgGFXcp (ORCPT ); Mon, 6 Jul 2020 19:32:45 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AE75C061755 for ; Mon, 6 Jul 2020 16:32:45 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id h5so27390218pgq.4 for ; Mon, 06 Jul 2020 16:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=4fIH4GN6n6dAxulY3f2rwIOekdlU8y7grvtSAmvPzI8=; b=J9lTuX6BUejRFhEHNFaUM+EGnZQ/75bZdLy4iNsT5Hfg9e9Vp2ZjxgzbX6pUw+Lcpn tg1r43Kv4uTk2BFurA1fcOtde1w2S5Je2ywaJQQJWmwP1e8BwNtQBgUHZQNR3MaXk813 KuuesbqVFVvSo/GTlZp2ModcBzp2zvzYYFI+7B3gCdZbgJX8NyUO1ctAA8jzvSYvoZ2S XjPbtdKmePRNKr5bdqJi4L7kLsiJO1NYgKJn8l9OGXLA+HENv1Ai/LM+1uZFkp7+mArP Lt24vuKQtog0Wr1766hzamg6DKROwdRAxNd37B1qvIDbC2ELunnN1EbkQ2Lt4eBKXH6n Gyyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=4fIH4GN6n6dAxulY3f2rwIOekdlU8y7grvtSAmvPzI8=; b=o8DQi8GRk6BtbRKXBHlK0rLaf9DAOLMkPyRtai7GG6j4C7MUTTqqWKehbxZI7CJKWX 7ljtk2ukhTa1Dg8C/0IyYDyYPwXH/8gOYInB9JIfUGaEFpU/CUsD6b4pXT4Zpz0Wz8TR OVjoEJ6n0Cklk3Af97qX7TMxb/AYaXu4zerWDQmcCzP6xQbYJ7aUr269JfJdOBmt6pYy D+tFdfcha7SbFTUGjScTbF3nA4X6qVAQb1iJwj6IxrWz198888Wf0Kf5NkPDObV+f7Co 6N6SdPy8Tf7+QWyD0uBAweu+bSABnfA8EIWICyruLxX/VIwfdXB/OEGpBoU1E1OS03gi M9gQ== X-Gm-Message-State: AOAM533Ir7XRnzSrXqSqlXH2Ab7OGUfGIkfaKqZHW4tFQUehszLj+pw9 oPOOwQI7h6NlhtVzQAYLi8qvlaC0UbKc X-Received: by 2002:a17:902:8c8a:: with SMTP id t10mr40175484plo.153.1594078364821; Mon, 06 Jul 2020 16:32:44 -0700 (PDT) Date: Mon, 6 Jul 2020 16:32:40 -0700 Message-Id: <20200706233240.3245512-1-rajatja@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog Subject: [PATCH RESEND v2] PCI: Add device even if driver attach failed From: Rajat Jain To: David Woodhouse , Lu Baolu , Joerg Roedel , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, Raj Ashok , lalithambika.krishnakumar@intel.com, Mika Westerberg , Jean-Philippe Brucker , Prashant Malani , Benson Leung , Todd Broch , Alex Levin , Mattias Nissler , Rajat Jain , Bernie Keany , Aaron Durbin , Diego Rivas , Duncan Laurie , Furquan Shaikh , Jesse Barnes , Christian Kellner , Alex Williamson , Greg Kroah-Hartman , oohall@gmail.com, Saravana Kannan , Suzuki K Poulose , Arnd Bergmann , Heikki Krogerus , stable@vger.kernel.org Cc: Rajat Jain Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. This patch partially reverts: commit ab1a187bba5c ("PCI: Check device_attach() return value always") Signed-off-by: Rajat Jain Reviewed-by: Greg Kroah-Hartman --- Resending to stable, independent from other patches per Greg's suggestion v2: Add Greg's reviewed by, fix commit log drivers/pci/bus.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 8e40b3e6da77d..3cef835b375fd 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -322,12 +322,8 @@ void pci_bus_add_device(struct pci_dev *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); } -- 2.27.0.212.ge8ba1cc988-goog