From: Dan Carpenter Date: Fri, 9 May 2025 11:04:31 +0000 (+0300) Subject: memory: stm32_omm: Fix error handling in stm32_omm_configure() X-Git-Tag: v6.16-rc1~100^2~3^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d44eeb20d9bedce11297a09628ba5dd39db236be;p=thirdparty%2Fkernel%2Fstable.git 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: 8181d061dcff ("memory: Add STM32 Octo Memory Manager driver") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/a69ce0445324e994ea2ed7493bda1f6046c7ff69.1746781081.git.dan.carpenter@linaro.org Signed-off-by: Krzysztof Kozlowski --- diff --git a/drivers/memory/stm32_omm.c b/drivers/memory/stm32_omm.c index bef7cf4391d6a..8704c774e6423 100644 --- a/drivers/memory/stm32_omm.c +++ b/drivers/memory/stm32_omm.c @@ -222,6 +222,7 @@ static int stm32_omm_configure(struct device *dev) clk_rate = clk_get_rate(omm->clk_bulk[i].clk); if (!clk_rate) { dev_err(dev, "Invalid clock rate\n"); + ret = -EINVAL; goto error; } @@ -230,8 +231,10 @@ static int stm32_omm_configure(struct device *dev) } rstc = devm_reset_control_get_exclusive(dev, "omm"); - if (IS_ERR(rstc)) - return dev_err_probe(dev, PTR_ERR(rstc), "reset get failed\n"); + if (IS_ERR(rstc)) { + ret = dev_err_probe(dev, PTR_ERR(rstc), "reset get failed\n"); + goto error; + } reset_control_assert(rstc); udelay(2);