Skip to content

Commit

Permalink
usb: chipidea: ci_hdrc_imx: add missing put_device() call in usbmisc_…
Browse files Browse the repository at this point in the history
…get_init_data()

commit 83a43ff upstream.

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: ef12da9 ("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>
  • Loading branch information
Yu Kuai authored and gregkh committed Jan 12, 2021
1 parent 150a9c1 commit 4485bdb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/usb/chipidea/ci_hdrc_imx.c
Expand Up @@ -139,9 +139,13 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
misc_pdev = of_find_device_by_node(args.np);
of_node_put(args.np);

if (!misc_pdev || !platform_get_drvdata(misc_pdev))
if (!misc_pdev)
return ERR_PTR(-EPROBE_DEFER);

if (!platform_get_drvdata(misc_pdev)) {
put_device(&misc_pdev->dev);
return ERR_PTR(-EPROBE_DEFER);
}
data->dev = &misc_pdev->dev;

/*
Expand Down

0 comments on commit 4485bdb

Please sign in to comment.