summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-05-11 19:01:20 +0200
committerStephen Boyd <sboyd@kernel.org>2023-06-15 02:22:50 +0200
commit9c632a6396505a019ea6d12b5ab45e659a542a93 (patch)
treeccfbc3f16aa11a85315a4d9b32f57a30565d1dcb
parentclk: bcm: rpi: Fix off by one in raspberrypi_discover_clocks() (diff)
downloadlinux-9c632a6396505a019ea6d12b5ab45e659a542a93.tar.xz
linux-9c632a6396505a019ea6d12b5ab45e659a542a93.zip
clk: clocking-wizard: Fix Oops in clk_wzrd_register_divider()
Smatch detected this potential error pointer dereference clk_wzrd_register_divider(). If devm_clk_hw_register() fails then it sets "hw" to an error pointer and then dereferences it on the next line. Return the error directly instead. Fixes: 5a853722eb32 ("staging: clocking-wizard: Add support for dynamic reconfiguration") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/f0e39b5c-4554-41e0-80d9-54ca3fabd060@kili.mountain Reviewed-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-rw-r--r--drivers/clk/xilinx/clk-xlnx-clock-wizard.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
index e83f104fad02..16df34f46280 100644
--- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
+++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
@@ -525,7 +525,7 @@ static struct clk *clk_wzrd_register_divider(struct device *dev,
hw = &div->hw;
ret = devm_clk_hw_register(dev, hw);
if (ret)
- hw = ERR_PTR(ret);
+ return ERR_PTR(ret);
return hw->clk;
}