]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
usb: ehci-orion: Handle errors of clk_prepare_enable() in probe
authorEvgeny Novikov <novikov@ispras.ru>
Wed, 25 Aug 2021 17:09:02 +0000 (20:09 +0300)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 11 Oct 2021 23:08:50 +0000 (17:08 -0600)
commit80959bfc7745252a57f13b8f2bd9726b8d3dfe4d
treef224c85bbfbe11f70e35cb97ee013dbcc656670a
parentab57bc81b374f614377baf59bc0d7faa4d0a2f18
usb: ehci-orion: Handle errors of clk_prepare_enable() in probe

BugLink: https://bugs.launchpad.net/bugs/1946024
[ Upstream commit 4720f1bf4ee4a784d9ece05420ba33c9222a3004 ]

ehci_orion_drv_probe() did not account for possible errors of
clk_prepare_enable() that in particular could cause invocation of
clk_disable_unprepare() on clocks that were not prepared/enabled yet,
e.g. in remove or on handling errors of usb_add_hcd() in probe. Though,
there were several patches fixing different issues with clocks in this
driver, they did not solve this problem.

Add handling of errors of clk_prepare_enable() in ehci_orion_drv_probe()
to avoid calls of clk_disable_unprepare() without previous successful
invocation of clk_prepare_enable().

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 8c869edaee07 ("ARM: Orion: EHCI: Add support for enabling clocks")
Co-developed-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Signed-off-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
Link: https://lore.kernel.org/r/20210825170902.11234-1-novikov@ispras.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/usb/host/ehci-orion.c