usb: ulpi: Use common error handling code in ulpi_register()
Subsystems (3)
PATCH 1/1 usb: ulpi: Use common error handling code in ulpi_register()
From: Markus Elfring <[email protected]>
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.
--- drivers/usb/common/ulpi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/usb/common/ulpi.c +7 -6
@@ -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; }/**
Signature · 1 line
2.54.0
Quoted 7 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Mon, 8 Jun 2026 14:17:57 +0200Use an additional label so that a bit of exception handling can be better reused at the end of this function implementation.
This is not a bug fix and clearly not stable material.
Quoted 1 line
Signed-off-by Markus Elfring <[email protected]>
A closer look at the code reveals that the device name is still being leaking on errors however (despite the recent flurry of related fixes).
I've just sent a fix here:
https://lore.kernel.org/r/[email protected]
Johan
Greg Kroah-Hartman
maintainerQuoted 4 lines · Johan Hovold
Quoted 3 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Mon, 8 Jun 2026 14:17:57 +0200
Quoted 8 lines
Quoted 4 lines
Use an additional label so that a bit of exception handling can be better reused at the end of this function implementation.
This is not a bug fix and clearly not stable material.
Quoted 1 line
Signed-off-by Markus Elfring <[email protected]>
Ah, this person's emails go to /dev/null for me, so I've not even considered it, so nothing to worry about :)
thanks,
greg k-h