Message ID | 20220127190004.1446909-2-sean.anderson@seco.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 092f45b13e51666fe8ecbf2d6cd247aa7e6c1f74 |
Headers | show |
Series | usb: ulpi: Fixes and debugfs support | expand |
On Thu, Jan 27, 2022 at 02:00:02PM -0500, Sean Anderson wrote: > Drivers are not unbound from the device when ulpi_unregister_interface > is called. Move of_node-freeing code to ulpi_dev_release which is called > only after all users are gone. > > Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") > Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > > Changes in v3: > - Use separate patch for moving of_node_put from unregister to release > > drivers/usb/common/ulpi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c > index 4169cf40a03b..c90a1ab705a3 100644 > --- a/drivers/usb/common/ulpi.c > +++ b/drivers/usb/common/ulpi.c > @@ -127,6 +127,7 @@ static const struct attribute_group *ulpi_dev_attr_groups[] = { > > static void ulpi_dev_release(struct device *dev) > { > + of_node_put(dev->of_node); > kfree(to_ulpi_dev(dev)); > } > > @@ -296,7 +297,6 @@ EXPORT_SYMBOL_GPL(ulpi_register_interface); > */ > void ulpi_unregister_interface(struct ulpi *ulpi) > { > - of_node_put(ulpi->dev.of_node); > device_unregister(&ulpi->dev); > } > EXPORT_SYMBOL_GPL(ulpi_unregister_interface); > -- > 2.25.1 thanks,
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index 4169cf40a03b..c90a1ab705a3 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -127,6 +127,7 @@ static const struct attribute_group *ulpi_dev_attr_groups[] = { static void ulpi_dev_release(struct device *dev) { + of_node_put(dev->of_node); kfree(to_ulpi_dev(dev)); } @@ -296,7 +297,6 @@ EXPORT_SYMBOL_GPL(ulpi_register_interface); */ void ulpi_unregister_interface(struct ulpi *ulpi) { - of_node_put(ulpi->dev.of_node); device_unregister(&ulpi->dev); } EXPORT_SYMBOL_GPL(ulpi_unregister_interface);
Drivers are not unbound from the device when ulpi_unregister_interface is called. Move of_node-freeing code to ulpi_dev_release which is called only after all users are gone. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Signed-off-by: Sean Anderson <sean.anderson@seco.com> --- Changes in v3: - Use separate patch for moving of_node_put from unregister to release drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)