usb: chipidea: ci_hdrc_imx: fix potential error pointer dereference in probe
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 17 Nov 2021 07:49:23 +0000 (10:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Dec 2021 08:04:40 +0000 (09:04 +0100)
commita815c169c8c4f1dac2444ca4d0217b766fbbd2af
tree2fffd2c26eb0ca5ac19f47fadcafe7421a93b2fa
parent39509d76a9a3d02f379d52cb4b1449469c56c0e0
usb: chipidea: ci_hdrc_imx: fix potential error pointer dereference in probe

commit d4d2e5329ae9dfd6742c84d79f7d143d10410f1b upstream.

If the first call to devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0)
fails with something other than -ENODEV then it leads to an error
pointer dereference.  For those errors we should just jump directly to
the error handling.

Fixes: 8253a34bfae3 ("usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211117074923.GF5237@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/ci_hdrc_imx.c