From: Bjorn Helgaas <helgaas@kernel.org>
To: Xichao Zhao <zhao.xichao@vivo.com>
Cc: daire.mcnamara@microchip.com, lpieralisi@kernel.org,
kwilczynski@kernel.org, mani@kernel.org, bhelgaas@google.com,
robh@kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: plda: Remove the use of dev_err_probe()
Date: Fri, 12 Sep 2025 17:09:32 -0500 [thread overview]
Message-ID: <20250912220932.GA1644863@bhelgaas> (raw)
In-Reply-To: <20250820085200.395578-1-zhao.xichao@vivo.com>
On Wed, Aug 20, 2025 at 04:52:00PM +0800, Xichao Zhao wrote:
> The dev_err_probe() doesn't do anything when error is '-ENOMEM'.
> Therefore, remove the useless call to dev_err_probe(), and just
> return the value instead.
Seems sort of weird to avoid dev_err_probe(-ENOMEM) because we have
internal knowledge that dev_err_probe() does nothing in that case.
It leads to patterns where the first few things in a .probe() function
return -ENOMEM directly and later things use dev_err_probe(), and
there's no obvious reason for the difference.
But it's very common, so I guess it's OK with me to follow the common
pattern even though it's a bit strange.
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
> drivers/pci/controller/plda/pcie-plda-host.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c
> index 8e2db2e5b64b..3c2f68383010 100644
> --- a/drivers/pci/controller/plda/pcie-plda-host.c
> +++ b/drivers/pci/controller/plda/pcie-plda-host.c
> @@ -599,8 +599,7 @@ int plda_pcie_host_init(struct plda_pcie_rp *port, struct pci_ops *ops,
>
> bridge = devm_pci_alloc_host_bridge(dev, 0);
> if (!bridge)
> - return dev_err_probe(dev, -ENOMEM,
> - "failed to alloc bridge\n");
> + return -ENOMEM;
>
> if (port->host_ops && port->host_ops->host_init) {
> ret = port->host_ops->host_init(port);
> --
> 2.34.1
>
prev parent reply other threads:[~2025-09-12 22:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 8:52 [PATCH] PCI: plda: Remove the use of dev_err_probe() Xichao Zhao
2025-09-08 10:13 ` Manivannan Sadhasivam
2025-09-15 13:25 ` [External] : " ALOK TIWARI
2025-09-15 14:07 ` Manivannan Sadhasivam
2025-09-15 19:10 ` ALOK TIWARI
2025-09-08 10:16 ` Manivannan Sadhasivam
2025-09-12 22:09 ` Bjorn Helgaas [this message]
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=20250912220932.GA1644863@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=daire.mcnamara@microchip.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=zhao.xichao@vivo.com \
/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