Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1622547ybv; Fri, 21 Feb 2020 00:28:29 -0800 (PST) X-Google-Smtp-Source: APXvYqxWVeEbgqL5EJ/VN6BLHkrlJ/MElaUPX0MZHldLoY+smYif546A16WcNw7ORMPuMDh38ahR X-Received: by 2002:aca:5a04:: with SMTP id o4mr1005041oib.113.1582273709433; Fri, 21 Feb 2020 00:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273709; cv=none; d=google.com; s=arc-20160816; b=eOFu8DE5byOJM4BulDsql720JI0C2QQGeygIFfkleSLMV5/hNNc/t0a8Z2FXR594/g I9Um5ZstEo3nXTj5GbOPPMKDBjGcjdvaatPkBCDwy8XUTwEvj2O+J4r9Ba8KkAp0X0xC LtnY720SX/CtOMy3IW+6S94EP2wldSRj3aZCdafeJ+vkmZu1AUu4qktK3Qlp69Jmtq/2 QXoPXgy1evEn0JQhAl3ujPCQ5EKESGe6rcUzHtM6cb6P3wVI0LVBOm+mkqpIUG0hh7sL ABwfvYnmPXscWqdSq/HXiOQ7gi7zG90IRNfliGFsc2C1wtivy5Aa4eMyuCnu3bPjsqvl MUUw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WCpQiLw51XJtyD6RVD+Fx+FOroW9EMh8aAqZ/o6HHQY=; b=JSKAqlK7gFXh8RgL1U7ImP4NMZ5iUpBgkNIUm2Vcmll8xmJYKwPOb9xd9pp/i6ho0A IhOJWmcRjoSidvlfQGyzvv3JVfRlFvGqSXc/OT2vw4RPVL8O5DVhFCUjZBSyfyTMjR15 pJ/62ScSMqr2H8/Vqhy5KCjcuINVzHdNyTZlE6XPup8XG6J43ttia/2sUGZZGiU6gqA1 CtW6nIpwJ7/Gy9znv1UOhG2xvf6/ioU5lznNHAL5hmYuUa4em74Cu0kfEbU+taJSB37m osJeqG9vfVFrssxAfTLx5bKdX4fVc4lcTpPa2h68j/RpwXdvFWKK4U9Ffuh+rmB/W9oE v9pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bJZeTYiH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t25si471023oic.183.2020.02.21.00.28.17; Fri, 21 Feb 2020 00:28:29 -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=bJZeTYiH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388569AbgBUI1f (ORCPT + 99 others); Fri, 21 Feb 2020 03:27:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:33134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730303AbgBUIVq (ORCPT ); Fri, 21 Feb 2020 03:21:46 -0500 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 6AC6220578; Fri, 21 Feb 2020 08:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273305; bh=H7Q6UGkUDohsAqgIcQdUPnUGdO92IToU1TSe781EBNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bJZeTYiHXWq6XK9lxFIIdi733E90l/sCV1RkQOrJ3p9lQ72unS95lsX0l8Kq0mFQZ GKBCO+QEYzFWDskG2q8bvnJDDQUVxIaoSjn5OUxPoUPnFhh37DOFZpTf+jDe9JtjS0 mWFyPJKKSx9nmZuLixFxLC+HnU/t1zKMSCtKh0e4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Sasha Levin Subject: [PATCH 4.19 120/191] driver core: Print device when resources present in really_probe() Date: Fri, 21 Feb 2020 08:41:33 +0100 Message-Id: <20200221072305.278715977@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 11d24a552ee49..5f6416e6ba96b 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -470,7 +470,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