patch "usb: ulpi: Call of_node_put correctly" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usb: ulpi: Call of_node_put correctly
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 0a907ee9d95e3ac35eb023d71f29eae0aaa52d1b Mon Sep 17 00:00:00 2001
From: Sean Anderson <[email protected]>
Date: Thu, 27 Jan 2022 14:00:03 -0500
Subject: usb: ulpi: Call of_node_put correctly
of_node_put should always be called on device nodes gotten from of_get_*. Additionally, it should only be called after there are no remaining users. To address the first issue, call of_node_put if later steps in ulpi_register fail. To address the latter, call put_device if device_register fails, which will call ulpi_dev_release if necessary.
--- drivers/usb/common/ulpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/common/ulpi.c +6 -2
@@ -248,12 +248,16 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)return ret; ret =ulpi_read_id (ulpi); -if (ret) +if (ret) { +of_node_put (ulpi->dev.of_node);return ret; + } ret =device_register (&ulpi->dev); -if (ret) +if (ret) { +put_device (&ulpi->dev);return ret; + }dev_dbg (&ulpi->dev,"registered ULPI PHY: vendor %04x, product %04x\n" , ulpi->id.vendor, ulpi->id.product);
Signature · 1 line
2.35.1