mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
USB: EHCI: ehci-mv: improve error handling in mv_ehci_enable()
[ Upstream commit 61136a12cb ]
mv_ehci_enable() did not disable and unprepare clocks in case of
failures of phy_init(). Besides, it did not take into account failures
of ehci_clock_enable() (in effect, failures of clk_prepare_enable()).
The patch fixes both issues and gets rid of redundant wrappers around
clk_prepare_enable() and clk_disable_unprepare() to simplify this a bit.
Found by Linux Driver Verification project (linuxtesting.org).
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Link: https://lore.kernel.org/r/20210708083056.21543-1-novikov@ispras.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b2b8137ec9
commit
5534de13b6
|
|
@ -42,26 +42,25 @@ struct ehci_hcd_mv {
|
||||||
int (*set_vbus)(unsigned int vbus);
|
int (*set_vbus)(unsigned int vbus);
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv)
|
|
||||||
{
|
|
||||||
clk_prepare_enable(ehci_mv->clk);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv)
|
|
||||||
{
|
|
||||||
clk_disable_unprepare(ehci_mv->clk);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv)
|
static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv)
|
||||||
{
|
{
|
||||||
ehci_clock_enable(ehci_mv);
|
int retval;
|
||||||
return phy_init(ehci_mv->phy);
|
|
||||||
|
retval = clk_prepare_enable(ehci_mv->clk);
|
||||||
|
if (retval)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
retval = phy_init(ehci_mv->phy);
|
||||||
|
if (retval)
|
||||||
|
clk_disable_unprepare(ehci_mv->clk);
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv)
|
static void mv_ehci_disable(struct ehci_hcd_mv *ehci_mv)
|
||||||
{
|
{
|
||||||
phy_exit(ehci_mv->phy);
|
phy_exit(ehci_mv->phy);
|
||||||
ehci_clock_disable(ehci_mv);
|
clk_disable_unprepare(ehci_mv->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mv_ehci_reset(struct usb_hcd *hcd)
|
static int mv_ehci_reset(struct usb_hcd *hcd)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user