]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: gadget: udc: renesas_usb3: fix device leak at unbind
authorJohan Hovold <johan@kernel.org>
Thu, 24 Jul 2025 09:19:08 +0000 (11:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Jul 2025 08:50:43 +0000 (10:50 +0200)
Make sure to drop the reference to the companion device taken during
probe when the driver is unbound.

Fixes: 39facfa01c9f ("usb: gadget: udc: renesas_usb3: Add register of usb role switch")
Cc: stable@vger.kernel.org # 4.19
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20250724091910.21092-4-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/renesas_usb3.c

index b93c1903d26a82fcd30baa89f1fb69a058d50c52..7cdcc9d16b8b13928ed3fdfa7d082d4382696d5f 100644 (file)
@@ -2657,6 +2657,7 @@ static void renesas_usb3_remove(struct platform_device *pdev)
        struct renesas_usb3 *usb3 = platform_get_drvdata(pdev);
 
        debugfs_remove_recursive(usb3->dentry);
+       put_device(usb3->host_dev);
        device_remove_file(&pdev->dev, &dev_attr_role);
 
        cancel_work_sync(&usb3->role_work);