mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
media: stm32: csi: add missing pm_runtime_put on error
Within the stm32_csi_start function, pm_runtime_put should be called upon error following pm_runtime_get_sync. Rework the function error handling by putting a label in order to have common error handling for all calls requiring pm_runtime_put. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
3114848ee2
commit
f7cd9c9495
1 changed files with 9 additions and 7 deletions
|
|
@ -497,21 +497,19 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev,
|
|||
|
||||
ret = pm_runtime_get_sync(csidev->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto error_put;
|
||||
|
||||
/* Retrieve CSI2PHY clock rate to compute CCFR value */
|
||||
phy_clk_frate = clk_get_rate(csidev->clks[STM32_CSI_CLK_CSI2PHY].clk);
|
||||
if (!phy_clk_frate) {
|
||||
pm_runtime_put(csidev->dev);
|
||||
dev_err(csidev->dev, "CSI2PHY clock rate invalid (0)\n");
|
||||
return ret;
|
||||
ret = -EINVAL;
|
||||
goto error_put;
|
||||
}
|
||||
|
||||
ret = stm32_csi_setup_lane_merger(csidev);
|
||||
if (ret) {
|
||||
pm_runtime_put(csidev->dev);
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
goto error_put;
|
||||
|
||||
/* Enable the CSI */
|
||||
writel_relaxed(STM32_CSI_CR_CSIEN, csidev->base + STM32_CSI_CR);
|
||||
|
|
@ -567,6 +565,10 @@ static int stm32_csi_start(struct stm32_csi_dev *csidev,
|
|||
writel_relaxed(0, csidev->base + STM32_CSI_PMCR);
|
||||
|
||||
return ret;
|
||||
|
||||
error_put:
|
||||
pm_runtime_put(csidev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void stm32_csi_stop(struct stm32_csi_dev *csidev)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue