Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp400991pxu; Tue, 1 Dec 2020 14:18:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvIx+5jHRnd+fcF8yQsnknxs3O0s8PMtR8tOXEKQNq9qZnW/VSYQKJFt94488k8nwXAqWm X-Received: by 2002:a17:906:6c2:: with SMTP id v2mr5159730ejb.387.1606861135897; Tue, 01 Dec 2020 14:18:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861135; cv=none; d=google.com; s=arc-20160816; b=zbM+T+1QRbEOqlYW7whq4JK5RCCK0Jg6LH/dL5T34jz4mB2lKqQUYiihmIzMf2W6Dj cpq/IGM2IibQI/tfkM+qW6vS3aKyTz2HvYCYoNtPPTiCe10AljQl0fydzo92LTJyZuRh Hd5jfPp0CZZgD67Qrk7mT7ov9jOiuPEa/kKCo2lTwhox2Ypsr1OpeVj7bQp4YQ+U5rfx 9leV3KdZaDKOojQeUaPt8DDdcnYIvH10rfgzPUDijHo3M89VZ5Cv9cLpBB+W/YKn7/nB bsko2Ovuhnukna3r3SPDszO9nfi988Yuff3W7vmfAU5U6Euj6g8P2OjsIo+CHEegsoip 0o7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XgAyoavbyyqm3PAae1BTepYAWwoBSa2T7m2+anD4DHU=; b=sGd6pjDE7qpBRlDKbvxdfYIb2h9lC42gC8aeqfGW+Cn2KsmHqLDdJWTdFSUogAB1YF EzcAnYzVRzvGPLt69UstJ1A3/rtCNLwObab8VAD3NCtTwCw0CAt6BVFGvsK/bSBXRc4L s2fATK0p+Ed6z1jeyzfwqFRWWBo2/wwfIYIhXGSNYyEiHWYzB6tCAMjfyfei6jGh84rx x4kZGvgL3Q2pYKpVbbdww+pGWATYmF62uXX3pEcOgVPAzdNvXd6xY/Y28Oq43jy4qK0M ihO8KdqcTouZFKmnhaTSCoXjz3u8O4bXDwrV3JgoU4BQq9wP2CWXz3snRcfU4H1QszQC le4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cFF9cT1s; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r15si771674edx.70.2020.12.01.14.18.33; Tue, 01 Dec 2020 14:18:55 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=cFF9cT1s; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729150AbgLAI4Z (ORCPT + 99 others); Tue, 1 Dec 2020 03:56:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:59586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387678AbgLAI4U (ORCPT ); Tue, 1 Dec 2020 03:56:20 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 F1FC121D7F; Tue, 1 Dec 2020 08:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606812939; bh=aEhNW8fhyTg4AhYeFdozIpWqmSjx864+GcAOrH+FIlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cFF9cT1s/vE81rfEYyrfwvf85ZXXs2zW1T9sYjyNDntEEnj4HKSguF2iioHOHLcK/ /YCXTINjSdtE9O/prqrYs82pVgnVKw4JrMM5MWiEhKvJndpin7gtscxKJOL8Vmfl0+ riqV6Bb8oe6gGsGXHvG4EIuKN0Ldb1gaK32AR8Jc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rajat Jain , Bjorn Helgaas , Sudip Mukherjee Subject: [PATCH 4.9 04/42] PCI: Add device even if driver attach failed Date: Tue, 1 Dec 2020 09:53:02 +0100 Message-Id: <20201201084642.384498201@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084642.194933793@linuxfoundation.org> References: <20201201084642.194933793@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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+ [sudip: use dev_warn] Signed-off-by: Sudip Mukherjee 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 @@ -324,12 +324,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) dev_warn(&dev->dev, "device attach failed (%d)\n", retval); - pci_proc_detach_device(dev); - pci_remove_sysfs_dev_files(dev); - return; - } dev->is_added = 1; }