Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Incomplete migration to `platform_device_set_of_node_from_dev()` leading to OF node reference leaks. --
commit fb8a9bf1bacccb38cbdade8a447f9b482f1bd4a3 Author: Bartosz Golaszewski <[email protected]> usb: musb: use platform_device_set_of_node_from_dev() Ahead of reworking the reference counting logic for platform devices, encapsulate the assignment of the OF node from another device for dynamically allocated platform devices with the provided helper. > diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c > index df56c972986f7..c770ba576f05b 100644 > --- a/drivers/usb/musb/jz4740.c > +++ b/drivers/usb/musb/jz4740.c > @@ -273,7 +273,7 @@ static int jz4740_probe(struct platform_device *pdev) > musb->dev.parent = dev; > musb->dev.dma_mask = &musb->dev.coherent_dma_mask; > musb->dev.coherent_dma_mask = DMA_BIT_MASK(32); > - device_set_of_node_from_dev(&musb->dev, dev); > + platform_device_set_of_node_from_dev(musb, dev); [Severity: High] Are there other MUSB drivers that need to be updated to prevent OF node reference leaks? When the dynamically allocated MUSB platform device is destroyed (e.g., during driver unbind or probe error), the reworked platform device reference counting will drop references using fwnode_handle_put(pdev->dev.fwnode) rather than of_node_put(pdev->dev.of_node). Because device_set_of_node_from_dev() doesn't set pdev->dev.fwnode, this leaves the fwnode pointer NULL and leaks the OF node reference. It looks like several other MUSB drivers still use device_set_of_node_from_dev() for dynamically allocated platform devices: - drivers/usb/musb/mpfs.c:mpfs_probe() - drivers/usb/musb/musb_dsps.c:dsps_create_musb_pdev() - drivers/usb/musb/omap2430.c:omap2430_probe() - drivers/usb/musb/ux500.c:ux500_probe() Will these also be updated to use platform_device_set_of_node_from_dev()? > > glue->pdev = musb; > glue->clk = clk; -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=17
