OSDN Git Service

usb: chipidea: properly handle host or gadget initialization failure
authorJisheng Zhang <jszhang@marvell.com>
Wed, 26 Apr 2017 08:59:34 +0000 (16:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:50:07 +0000 (19:50 +0200)
commit10b7c3b33c02257b574f8f00df4b1e4a722fd630
tree676fd3cbc6821721e3def4204054eac336764e59
parentcac18a2f4b25c087811028d74ee4552e382e3f29
usb: chipidea: properly handle host or gadget initialization failure

[ Upstream commit c4a0bbbdb7f6e3c37fa6deb3ef28c5ed99da6175 ]

If ci_hdrc_host_init() or ci_hdrc_gadget_init() returns error and the
error != -ENXIO, as Peter pointed out, "it stands for initialization
for host or gadget has failed", so we'd better return failure rather
continue.

And before destroying the otg, i.e ci_hdrc_otg_destroy(ci), we should
also check ci->roles[CI_ROLE_GADGET].

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/core.c