mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
sh: clk: Fix clk_enable() to return 0 on NULL clk
commit ff30bd6a66 upstream.
On SH, devm_clk_get_optional_enabled() fails with -EINVAL if the clock
is not found. This happens because __devm_clk_get() assumes it can pass
a NULL clock pointer (as returned by clk_get_optional()) to the init()
function (clk_prepare_enable() in this case), while the SH
implementation of clk_enable() considers that an error.
Fix this by making the SH clk_enable() implementation return zero
instead, like the Common Clock Framework does.
Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/b53e6b557b4240579933b3359dda335ff94ed5af.1675354849.git.geert+renesas@glider.be
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a8a1a7949d
commit
2d9a4ff1a5
@@ -295,7 +295,7 @@ int clk_enable(struct clk *clk)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!clk)
|
if (!clk)
|
||||||
return -EINVAL;
|
return 0;
|
||||||
|
|
||||||
spin_lock_irqsave(&clock_lock, flags);
|
spin_lock_irqsave(&clock_lock, flags);
|
||||||
ret = __clk_enable(clk);
|
ret = __clk_enable(clk);
|
||||||
|
|||||||
Reference in New Issue
Block a user