mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>
Cc: kernel@collabora.com, linux-kernel@vger.kernel.org,
	"Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Subject: [PATCH 1/3] driver: core: Log probe failure as error and with device metadata
Date: Tue, 05 Mar 2024 17:21:36 -0500	[thread overview]
Message-ID: <20240305-device-probe-error-v1-1-a06d8722bf19@collabora.com> (raw)
In-Reply-To: <20240305-device-probe-error-v1-0-a06d8722bf19@collabora.com>

Drivers can return -ENODEV or -ENXIO from their probe to reject a device
match, and return -EPROBE_DEFER if probe should be retried. Any other
error code is not expected during normal behavior and indicates an
issue occurred, so it should be logged at the error level.

Also make use of the device variant, dev_err(), so that the device
metadata is attached to the log message.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
 drivers/base/dd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 85152537dbf1..0b7cf4516796 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -592,8 +592,8 @@ static int call_driver_probe(struct device *dev, struct device_driver *drv)
 		break;
 	default:
 		/* driver matched but the probe failed */
-		pr_warn("%s: probe of %s failed with error %d\n",
-			drv->name, dev_name(dev), ret);
+		dev_err(dev, "probe with driver %s failed with error %d\n",
+			drv->name, ret);
 		break;
 	}
 

-- 
2.44.0


  reply	other threads:[~2024-03-05 22:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 22:21 [PATCH 0/3] device: core: Adjust device probe log messages to ease error detection Nícolas F. R. A. Prado
2024-03-05 22:21 ` Nícolas F. R. A. Prado [this message]
2024-03-05 22:21 ` [PATCH 2/3] driver: core: Use dev_* instead of pr_* so device metadata is added Nícolas F. R. A. Prado
2024-03-05 22:21 ` [PATCH 3/3] device: core: Log warning for devices pending deferred probe on timeout Nícolas F. R. A. Prado

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=20240305-device-probe-error-v1-1-a06d8722bf19@collabora.com \
    --to=nfraprado@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®