From: Yan Zhen <yanzhen@vivo.com>
To: pawell@cadence.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
opensource.kernel@vivo.com, Yan Zhen <yanzhen@vivo.com>
Subject: [PATCH v1] usb: gadget: udc: cdns2: Simplify with dev_err_probe()
Date: Thu, 29 Aug 2024 19:28:22 +0800 [thread overview]
Message-ID: <20240829112822.3193428-1-yanzhen@vivo.com> (raw)
Use dev_err_probe() to simplify the error path and unify a
message template.
Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.
The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.
Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
drivers/usb/gadget/udc/cdns2/cdns2-pci.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-pci.c b/drivers/usb/gadget/udc/cdns2/cdns2-pci.c
index 50c3d0974d9b..0e904085d968 100644
--- a/drivers/usb/gadget/udc/cdns2/cdns2-pci.c
+++ b/drivers/usb/gadget/udc/cdns2/cdns2-pci.c
@@ -35,10 +35,8 @@ static int cdns2_pci_probe(struct pci_dev *pdev,
return -EINVAL;
ret = pcim_enable_device(pdev);
- if (ret) {
- dev_err(&pdev->dev, "Enabling PCI device has failed %d\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "Enabling PCI device has failed\n");
pci_set_master(pdev);
--
2.34.1
next reply other threads:[~2024-08-29 11:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 11:28 Yan Zhen [this message]
2024-08-29 17:04 ` [PATCH v1] usb: gadget: udc: cdns2: Simplify with dev_err_probe() Christophe JAILLET
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=20240829112822.3193428-1-yanzhen@vivo.com \
--to=yanzhen@vivo.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=pawell@cadence.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