Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c113f7d authored by Fabio Estevam's avatar Fabio Estevam Committed by Felipe Balbi
Browse files

usb: phy: phy-generic: Check clk_prepare_enable() error



clk_prepare_enable() may fail, so we should better check its return
value and propagate it in the case of failure.

Signed-off-by: default avatarFabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent b2f1eaae
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -144,14 +144,18 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
int usb_gen_phy_init(struct usb_phy *phy)
{
	struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
	int ret;

	if (!IS_ERR(nop->vcc)) {
		if (regulator_enable(nop->vcc))
			dev_err(phy->dev, "Failed to enable power\n");
	}

	if (!IS_ERR(nop->clk))
		clk_prepare_enable(nop->clk);
	if (!IS_ERR(nop->clk)) {
		ret = clk_prepare_enable(nop->clk);
		if (ret)
			return ret;
	}

	nop_reset(nop);