Skip to content

Commit d44eeb2

Browse files
Dan Carpenterkrzk
authored andcommitted
memory: stm32_omm: Fix error handling in stm32_omm_configure()
There are two error handling bugs in the stm32_omm_configure() function. 1) The error code needs to be set if clk_get_rate() fails. 2) If devm_reset_control_get_exclusive() then call pm_runtime_put_sync_suspend() before returning. Fixes: 8181d06 ("memory: Add STM32 Octo Memory Manager driver") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/a69ce0445324e994ea2ed7493bda1f6046c7ff69.1746781081.git.dan.carpenter@linaro.org Signed-off-by: Krzysztof Kozlowski <[email protected]>
1 parent 9c03507 commit d44eeb2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/memory/stm32_omm.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ static int stm32_omm_configure(struct device *dev)
222222
clk_rate = clk_get_rate(omm->clk_bulk[i].clk);
223223
if (!clk_rate) {
224224
dev_err(dev, "Invalid clock rate\n");
225+
ret = -EINVAL;
225226
goto error;
226227
}
227228

@@ -230,8 +231,10 @@ static int stm32_omm_configure(struct device *dev)
230231
}
231232

232233
rstc = devm_reset_control_get_exclusive(dev, "omm");
233-
if (IS_ERR(rstc))
234-
return dev_err_probe(dev, PTR_ERR(rstc), "reset get failed\n");
234+
if (IS_ERR(rstc)) {
235+
ret = dev_err_probe(dev, PTR_ERR(rstc), "reset get failed\n");
236+
goto error;
237+
}
235238

236239
reset_control_assert(rstc);
237240
udelay(2);

0 commit comments

Comments
 (0)