media: marvell: Added function return value check clk_prepare

Message ID 20231024130916.19419-1-arefev@swemel.ru
State New
Headers
Series media: marvell: Added function return value check clk_prepare |

Commit Message

Denis Arefev Oct. 24, 2023, 1:09 p.m. UTC
  Return value of function 'clk_prepare', called at mcam-core.c:905,
	is not checked, but it is usually checked for this function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 drivers/media/platform/marvell/mcam-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Alexey Khoroshilov Oct. 24, 2023, 1:35 p.m. UTC | #1
Dear Denis,

On 24.10.2023 16:09, Denis Arefev wrote:
> 	Return value of function 'clk_prepare', called at mcam-core.c:905,
> 	is not checked, but it is usually checked for this function.

Something is wrong with the indents in the commit message.

> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
>  drivers/media/platform/marvell/mcam-core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/marvell/mcam-core.c b/drivers/media/platform/marvell/mcam-core.c
> index 66688b4aece5..afb7f4009d96 100644
> --- a/drivers/media/platform/marvell/mcam-core.c
> +++ b/drivers/media/platform/marvell/mcam-core.c
> @@ -901,9 +901,10 @@ static void mcam_ctlr_power_down(struct mcam_camera *cam)
>  static int mclk_prepare(struct clk_hw *hw)
>  {
>  	struct mcam_camera *cam = container_of(hw, struct mcam_camera, mclk_hw);
> -
> -	clk_prepare(cam->clk[0]);
> -	return 0;
> +	int ret;
> +
> +	ret = clk_prepare(cam->clk[0]);
> +	return ret;


Why do we need to introduce an intermediate variable?

--
Alexey
  

Patch

diff --git a/drivers/media/platform/marvell/mcam-core.c b/drivers/media/platform/marvell/mcam-core.c
index 66688b4aece5..afb7f4009d96 100644
--- a/drivers/media/platform/marvell/mcam-core.c
+++ b/drivers/media/platform/marvell/mcam-core.c
@@ -901,9 +901,10 @@  static void mcam_ctlr_power_down(struct mcam_camera *cam)
 static int mclk_prepare(struct clk_hw *hw)
 {
 	struct mcam_camera *cam = container_of(hw, struct mcam_camera, mclk_hw);
-
-	clk_prepare(cam->clk[0]);
-	return 0;
+	int ret;
+
+	ret = clk_prepare(cam->clk[0]);
+	return ret;
 }
 
 static void mclk_unprepare(struct clk_hw *hw)