From: Markus Elfring <Markus.Elfring@web.de>
To: linux-usb@vger.kernel.org, Felix Gu <ustc.gu@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] usb: ulpi: Use common error handling code in ulpi_register()
Date: Mon, 8 Jun 2026 14:35:11 +0200 [thread overview]
Message-ID: <a65ed0db-6519-4665-bafc-1bb15752ff2f@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 Jun 2026 14:17:57 +0200
Use an additional label so that a bit of exception handling can be better
reused at the end of this function implementation.
Cc: stable@vger.kernel.org
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/usb/common/ulpi.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 9b69148128e5..1b9a4995903d 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -286,16 +286,13 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)
ACPI_COMPANION_SET(&ulpi->dev, ACPI_COMPANION(dev));
ret = ulpi_of_register(ulpi);
- if (ret) {
- kfree(ulpi);
- return ret;
- }
+ if (ret)
+ goto free_ulpi;
ret = ulpi_read_id(ulpi);
if (ret) {
of_node_put(ulpi->dev.of_node);
- kfree(ulpi);
- return ret;
+ goto free_ulpi;
}
ret = device_register(&ulpi->dev);
@@ -311,6 +308,10 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)
ulpi->id.vendor, ulpi->id.product);
return 0;
+
+free_ulpi:
+ kfree(ulpi);
+ return ret;
}
/**
--
2.54.0
next reply other threads:[~2026-06-08 12:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 12:35 Markus Elfring [this message]
2026-06-08 14:59 ` [PATCH] usb: ulpi: Use common error handling code in ulpi_register() Johan Hovold
2026-06-08 15:36 ` Greg Kroah-Hartman
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=a65ed0db-6519-4665-bafc-1bb15752ff2f@web.de \
--to=markus.elfring@web.de \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ustc.gu@gmail.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