From: Patrick Delaunay Date: Mon, 24 Jan 2022 13:17:14 +0000 (+0100) Subject: clk: ccf: correct the test on the parent uclass in clk_enable/clk_disable X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=b0cdd8287add19d1af6668b6e9e968046506c08d;p=u-boot.git clk: ccf: correct the test on the parent uclass in clk_enable/clk_disable It is safe to check if the uclass id on the device is UCLASS_CLK before to call the clk_ functions, but today this comparison is not done on the device used in API: clkp->dev->parent but on the device himself: clkp->dev. This patch corrects this behavior and tests if the parent device is a clock device before to call the clock API, clk_enable or clk_disable, on this device. Fixes: 0520be0f67e3 ("clk: prograte clk enable/disable to parent") Signed-off-by: Patrick Delaunay Reviewed-by: Sean Anderson --- diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index fca4b8321a..c20c928bf1 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -641,7 +641,7 @@ int clk_enable(struct clk *clk) return 0; } if (clkp->dev->parent && - device_get_uclass_id(clkp->dev) == UCLASS_CLK) { + device_get_uclass_id(clkp->dev->parent) == UCLASS_CLK) { ret = clk_enable(dev_get_clk_ptr(clkp->dev->parent)); if (ret) { printf("Enable %s failed\n", @@ -715,7 +715,7 @@ int clk_disable(struct clk *clk) } if (clkp && clkp->dev->parent && - device_get_uclass_id(clkp->dev) == UCLASS_CLK) { + device_get_uclass_id(clkp->dev->parent) == UCLASS_CLK) { ret = clk_disable(dev_get_clk_ptr(clkp->dev->parent)); if (ret) { printf("Disable %s failed\n",