Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1945341ybv; Fri, 14 Feb 2020 08:39:39 -0800 (PST) X-Google-Smtp-Source: APXvYqw6ZB3necJUhTL+di/d0VGxvQSmZVm2GR9Fe+ItHxwYDvRKMntktR0bmfadqwswVwMEiteK X-Received: by 2002:a05:6830:22e2:: with SMTP id t2mr3066171otc.129.1581698379265; Fri, 14 Feb 2020 08:39:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698379; cv=none; d=google.com; s=arc-20160816; b=lXypDH3HO1Fl5mbELEPS1dTjTgamsijiTIZl9hmFBXKyj6yunTblOObqbr/qEs+eRt XjbIResa01jB0Mg1wMxnLMBbJB4Dp8sIU6IJAKOhbhDg94pB70sSZmbs2G9ZyIHoHBjo VW3AFBZUrKndtxSKnT+uohlzb7Xpj08v5b6a9xJ8uGyYXiwGQ+FpWBuepRXGNor8yDtT DcuS9KrGJae2pqoGD6xq0TEzFcmPg/a+tdSXjmOCi+XhspQjCy5WBTdJ64L65+cjotva M22AGgRqSXzx6ZD69k4WVOnVig9oocHRnjqr2piYCM90jfKIsZZ85m0j1mUwi9AhjGk7 zL8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7R6rHlfHraO/9IdAgkGEiKE1h2SAmKSRAzfa8cqfEdQ=; b=y2gWKx7mqzVn8MQi0wUHT+Sf7Yxw2yAPUMScBxeOUiAx9WzLTD3S7seNX0tGPi5Mzz j9+vyvib+gaUvySzbQE1uCmvC9lTdseqM4wKYELueV/A0YrgQiZS16pjFuIV2T65bkmz b3ucdYINQd64vaoMvXe07DAP+AVSGoW07PGPOqH93s/rF/GE5OE0E4thiQ8K89ofKiaF JNc7SG8DXxZjbUZcqRvIbP5DH6eRHhW6ij5ibyeQ4hN7MUfN4QB1hD3HJs5RB3Y1mxFV NjfjObFNi2c94zrL5lH6M166LqnT3AywxbFpDCN+0wRgO3oYLwTNTJq/zHvwlkG6nsAy My9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=krHNYKUe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si2893849oie.50.2020.02.14.08.39.27; Fri, 14 Feb 2020 08:39:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=krHNYKUe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393687AbgBNQiu (ORCPT + 99 others); Fri, 14 Feb 2020 11:38:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:59594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405627AbgBNQXW (ORCPT ); Fri, 14 Feb 2020 11:23:22 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3FC052477D; Fri, 14 Feb 2020 16:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697401; bh=QF+GM9/wVb1HaoupTgbLeTFq/iwqSRZpYgfw/Bq0fhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=krHNYKUe4EmqbN8pXSggfdAh5TW4V1lzkyziVhSY1VqUDQ8Z1E30fJem48UlfVDdh rjsErLzw6eBlJNuHr7G29MXXMn0bun5iikz4tYBaUbiPJkS1SvrwxihrGqmsLvJrYj Bz46nzTcI515PWulbqV5IJNTVFj4RoWc91mAW4Bg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Geert Uytterhoeven , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 4.9 095/141] driver core: Print device when resources present in really_probe() Date: Fri, 14 Feb 2020 11:20:35 -0500 Message-Id: <20200214162122.19794-95-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 7c35e699c88bd60734277b26962783c60e04b494 ] If a device already has devres items attached before probing, a warning backtrace is printed. However, this backtrace does not reveal the offending device, leaving the user uninformed. Furthermore, using WARN_ON() causes systems with panic-on-warn to reboot. Fix this by replacing the WARN_ON() by a dev_crit() message. Abort probing the device, to prevent doing more damage to the device's resources. Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20191206132219.28908-1-geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/base/dd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index ee25a69630c3a..854d218ea76ac 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -341,7 +341,10 @@ static int really_probe(struct device *dev, struct device_driver *drv) atomic_inc(&probe_count); pr_debug("bus: '%s': %s: probing driver %s with device %s\n", drv->bus->name, __func__, drv->name, dev_name(dev)); - WARN_ON(!list_empty(&dev->devres_head)); + if (!list_empty(&dev->devres_head)) { + dev_crit(dev, "Resources present before probing\n"); + return -EBUSY; + } re_probe: dev->driver = drv; -- 2.20.1