All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] driver core: Print device in really_probe() warning backtrace
Date: Thu, 21 Nov 2019 14:57:43 +0100	[thread overview]
Message-ID: <20191121135743.GA552517@kroah.com> (raw)
In-Reply-To: <20191120143619.1027-3-geert+renesas@glider.be>

On Wed, Nov 20, 2019 at 03:36:19PM +0100, Geert Uytterhoeven wrote:
> 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.
> 
> Use dev_WARN_ON() instead of WARN_ON() to fix this.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/base/dd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index d811e60610d33ae9..a7e8040ef0003f44 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -516,7 +516,7 @@ 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));
> +	dev_WARN_ON(dev, !list_empty(&dev->devres_head));

We really do not want WARN_ON() anywhere, as that causes systems with
panic-on-warn to reboot.

If this can happen, we should switch it to a real error message, with
dev_err() and the like, and recover properly.

I don't want to make it easier to add WARN_ON() lines, like
dev_WARN_ON() would allow, instead we should be removing them, as they
encourage slopping programming habits.

thanks,

greg k-h

  reply	other threads:[~2019-11-21 13:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 14:36 [PATCH 0/2] driver core: Improve warning backtrace in device probing Geert Uytterhoeven
2019-11-20 14:36 ` [PATCH 1/2] driver core: Add dev_WARN_ON() helper Geert Uytterhoeven
2019-11-20 14:36 ` [PATCH 2/2] driver core: Print device in really_probe() warning backtrace Geert Uytterhoeven
2019-11-21 13:57   ` Greg Kroah-Hartman [this message]
2019-11-21 14:08     ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191121135743.GA552517@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.