From fc157998b8257fb9cfe753e7f4af1411da995c9b Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Thu, 23 Jan 2020 16:38:23 +0100 Subject: [PATCH] staging: most: usb: check for NULL device Check if the dci structer has been allocated before trying to release it. Signed-off-by: Christian Gromm Link: https://lore.kernel.org/r/1579793906-5054-8-git-send-email-christian.gromm@microchip.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/usb/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c index dcc78cd870b8..0bda88c4bc89 100644 --- a/drivers/staging/most/usb/usb.c +++ b/drivers/staging/most/usb/usb.c @@ -1218,7 +1218,8 @@ static void hdm_disconnect(struct usb_interface *interface) del_timer_sync(&mdev->link_stat_timer); cancel_work_sync(&mdev->poll_work_obj); - device_unregister(&mdev->dci->dev); + if (mdev->dci) + device_unregister(&mdev->dci->dev); most_deregister_interface(&mdev->iface); kfree(mdev->busy_urbs);