Add a new error message like
nvme nvme0: probe failed on 2004:00:00.0 (result: -19)
that makes failures to probe visible in the kernel log.
Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
---
drivers/nvme/host/pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c916176bd9f058b49e6e6768675711df52b15765..7544c4bac2c4a230d32cf729abb9e94bf93a921f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3519,6 +3519,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
out_dev_unmap:
nvme_dev_unmap(dev);
out_uninit_ctrl:
+ dev_err(dev->ctrl.device, "probe failed on %s (result: %d)\n",
+ dev_name(&pdev->dev), result);
nvme_uninit_ctrl(&dev->ctrl);
out_put_ctrl:
nvme_put_ctrl(&dev->ctrl);
--
2.48.1
On Mon, Oct 20, 2025 at 05:29:07PM +0200, Gerd Bayer wrote: > Add a new error message like > nvme nvme0: probe failed on 2004:00:00.0 (result: -19) > that makes failures to probe visible in the kernel log. Is that really a thing drivers are expected to do? If it is generally usefull I'd expect it to be in the driver core. Also for nvme most "interesting" errors happen in the reset workqueue and not in ->probe itself.
On Wed, Oct 22, 2025 at 08:26:34AM +0200, Christoph Hellwig wrote: > On Mon, Oct 20, 2025 at 05:29:07PM +0200, Gerd Bayer wrote: > > Add a new error message like > > nvme nvme0: probe failed on 2004:00:00.0 (result: -19) > > that makes failures to probe visible in the kernel log. > > Is that really a thing drivers are expected to do? If it is generally > usefull I'd expect it to be in the driver core. We have that already, dev_err_probe(), no need to create yet-another-version of that. thanks, greg k-h
On Wed, 2025-10-22 at 09:48 +0200, Greg Kroah-Hartman wrote: > On Wed, Oct 22, 2025 at 08:26:34AM +0200, Christoph Hellwig wrote: > > On Mon, Oct 20, 2025 at 05:29:07PM +0200, Gerd Bayer wrote: > > > Add a new error message like > > > nvme nvme0: probe failed on 2004:00:00.0 (result: -19) > > > that makes failures to probe visible in the kernel log. > > > > Is that really a thing drivers are expected to do? If it is generally > > usefull I'd expect it to be in the driver core. > > We have that already, dev_err_probe(), no need to create > yet-another-version of that. So I take this as an implict answer to the question, if drivers are expected to do this or the driver core: Drivers. Before learning about dev_err_probe() I was sampling a few drivers' probe functions and got inconclusive results regarding their verbosity regarding logging errors in probe. Interestingly, none of my samples used dev_err_probe()... While for most drivers it may be obvious that in most sytem configurations it will not go unnoticed that e.g. the graphics controller failed to probe - there may be other components/configurations and a centralized error reporting e.g. in local_pci_probe() would have its benefits. But then with so many drivers already using dev_err_probe(), we don't want to report this twice, now. Thus, I'm going to convert my patch over for a v2. Thanks, Gerd
On Mon, 2025-10-20 at 17:29 +0200, Gerd Bayer wrote: > Add a new error message like > nvme nvme0: probe failed on 2004:00:00.0 (result: -19) > that makes failures to probe visible in the kernel log. > > Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com> > --- > drivers/nvme/host/pci.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index > c916176bd9f058b49e6e6768675711df52b15765..7544c4bac2c4a230d32cf729abb > 9e94bf93a921f 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -3519,6 +3519,8 @@ static int nvme_probe(struct pci_dev *pdev, > const struct pci_device_id *id) > out_dev_unmap: > nvme_dev_unmap(dev); > out_uninit_ctrl: > + dev_err(dev->ctrl.device, "probe failed on %s (result: > %d)\n", > + dev_name(&pdev->dev), result); > nvme_uninit_ctrl(&dev->ctrl); > out_put_ctrl: > nvme_put_ctrl(&dev->ctrl); Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com> Wilfred
© 2016 - 2026 Red Hat, Inc.