Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4293207pxu; Tue, 1 Dec 2020 01:02:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/uIb2iGJTkC/ulNReEglBWnV7g9a+1q2nBy0J+mcruPYBuHT2C4WjxPiGM5UU9tPvt5kB X-Received: by 2002:a05:6402:2377:: with SMTP id a23mr1984139eda.34.1606813344991; Tue, 01 Dec 2020 01:02:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606813344; cv=none; d=google.com; s=arc-20160816; b=aEf1M+8647/48VZ40B5bc9w/aVcebIzzGISStPElBtQa2iqI4juUfUNUPZz8uMGQ+v sd80Vkmf23FNLEjy0n05oJZyPcQ7x57nfhW+lQZj1mBkBwjO1lufjSqsP8nz6LfMNwTX ulq/espRjpjpVlp8zD3LNzRTQsLH76834+nsuwmwLbJQ3m9Q+krVreRf9dt3RP4Ep0Zq F3ln4EIR2sWzKLlIXT/X32PGC1RQCyAMOiIy4Pds9ZtivuephyClUiEydh90As4rVzm4 KRLlsTVaeGwjDxANxh1EVtSOSlvKD7tw9kw9rf+tfihUrV4pmlqmHGDtysNn2xmHE+rB N02A== 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=dG7V0OVxujz66v4HRMeReEkHKOVR7nZWMW7EJCJ7uvg7OQ0I4eUB7pQjVixKPjTyUw bR/XWlLlqP6AXupmBgHi4yiaCwMzRGz3xnMiU65HdhbNLazA0S7rh9S2BixDYrLCGN72 v0tJRFcpas9G0GqQyA/WVbfMqh3VePc3jexaEm9wwwQPaloWmSwnJ1r3iDHQa23d6kzv tAAfMg51w429iklYNLc9P8a2lhZxdz9d/ZuKQrsC37bX6fB44W9uZ5qnMcZUYz6jICl3 axTSE6BZSxl56eo5VmOI9jo59L9HoqJ1x0y8zVOM8O6rpdxbNuIVTBMvxwfx8FPZ/hy9 7cMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ICQbR2oh; 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 u19si512947ejf.121.2020.12.01.01.02.02; Tue, 01 Dec 2020 01:02:24 -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=ICQbR2oh; 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 S2387959AbgLAI6c (ORCPT + 99 others); Tue, 1 Dec 2020 03:58:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:33962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387936AbgLAI6Z (ORCPT ); Tue, 1 Dec 2020 03:58:25 -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 D333321D7F; Tue, 1 Dec 2020 08:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813064; bh=aEhNW8fhyTg4AhYeFdozIpWqmSjx864+GcAOrH+FIlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICQbR2ohpY5bS0y5OE9mozEhW71oTIfokg1Dlvga9EY0R000rzk9eKr4jpRGjUC4y gaPGq+5ZOkt83QI8csEs8J3azuxsvXivwM8aa7hDRq8sguxZZ4v0LE2vcuB8U7PM65 UAhhSFMlFfHwqA/MXHaQl5EJ8Kg51v/f2289scl8= 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.14 05/50] PCI: Add device even if driver attach failed Date: Tue, 1 Dec 2020 09:53:04 +0100 Message-Id: <20201201084645.400985843@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084644.803812112@linuxfoundation.org> References: <20201201084644.803812112@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; }