]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: renesas_usbhs: Call clk_put()
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tue, 25 Feb 2025 11:02:46 +0000 (13:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:47:40 +0000 (12:47 +0100)
commit b5ea08aa883da05106fcc683d12489a4292d1122 upstream.

Clocks acquired with of_clk_get() need to be freed with clk_put(). Call
clk_put() on priv->clks[0] on error path.

Fixes: 3df0e240caba ("usb: renesas_usbhs: Add multiple clocks management")
Cc: stable <stable@kernel.org>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/r/20250225110248.870417-2-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/renesas_usbhs/common.c

index 3af91b2b8f7690cf5094a9ff0b6d65af6432f13c..116aadd5603c55690053e0d0289f2ff25ce60f28 100644 (file)
@@ -312,8 +312,10 @@ static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv)
        priv->clks[1] = of_clk_get(dev_of_node(dev), 1);
        if (PTR_ERR(priv->clks[1]) == -ENOENT)
                priv->clks[1] = NULL;
-       else if (IS_ERR(priv->clks[1]))
+       else if (IS_ERR(priv->clks[1])) {
+               clk_put(priv->clks[0]);
                return PTR_ERR(priv->clks[1]);
+       }
 
        return 0;
 }