Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: chipidea: ci_hdrc_imx: add missing put_device() call in usbmisc_get_init_data()

if of_find_device_by_node() succeed, usbmisc_get_init_data() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.

Fixes: ef12da914ed6 ("usb: chipidea: imx: properly check for usbmisc")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201117011430.642589-1-yukuai3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Yu Kuai and committed by
Greg Kroah-Hartman
83a43ff8 0a88fa22

+5 -1
+5 -1
drivers/usb/chipidea/ci_hdrc_imx.c
··· 139 139 misc_pdev = of_find_device_by_node(args.np); 140 140 of_node_put(args.np); 141 141 142 - if (!misc_pdev || !platform_get_drvdata(misc_pdev)) 142 + if (!misc_pdev) 143 143 return ERR_PTR(-EPROBE_DEFER); 144 144 145 + if (!platform_get_drvdata(misc_pdev)) { 146 + put_device(&misc_pdev->dev); 147 + return ERR_PTR(-EPROBE_DEFER); 148 + } 145 149 data->dev = &misc_pdev->dev; 146 150 147 151 /*