From 869d3acd488c282421468b60b5c6ed205c1da1b0 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 28 Sep 2018 23:37:19 +0200 Subject: [PATCH] staging: most: usb: add release function for DCI device This patch adds the missing release function for the DCI device that frees the container structure it is embedded in. Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/usb/usb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c index 7869e8463438..c0293d8d5934 100644 --- a/drivers/staging/most/usb/usb.c +++ b/drivers/staging/most/usb/usb.c @@ -1015,6 +1015,13 @@ static const struct attribute_group *dci_attr_groups[] = { NULL, }; +static void release_dci(struct device *dev) +{ + struct most_dci_obj *dci = to_dci_obj(dev); + + kfree(dci); +} + /** * hdm_probe - probe function of USB device driver * @interface: Interface of the attached USB device @@ -1146,6 +1153,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id) mdev->dci->dev.init_name = "dci"; mdev->dci->dev.parent = &mdev->iface.dev; mdev->dci->dev.groups = dci_attr_groups; + mdev->dci->dev.release = release_dci; if (device_register(&mdev->dci->dev)) { mutex_unlock(&mdev->io_mutex); most_deregister_interface(&mdev->iface); @@ -1198,7 +1206,6 @@ static void hdm_disconnect(struct usb_interface *interface) cancel_work_sync(&mdev->poll_work_obj); device_unregister(&mdev->dci->dev); - kfree(mdev->dci); most_deregister_interface(&mdev->iface); kfree(mdev->busy_urbs); -- 2.30.2