diff mbox series

media: s5p-mfc: Handle error for clk_enable

Message ID 20220308075538.1117983-1-jiasheng@iscas.ac.cn (mailing list archive)
State New, archived
Headers show
Series media: s5p-mfc: Handle error for clk_enable | expand

Commit Message

Jiasheng Jiang March 8, 2022, 7:55 a.m. UTC
As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: 1bce6fb3edf1 ("[media] s5p-mfc: Rework clock handling")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andrzej Hajda March 8, 2022, 10:50 a.m. UTC | #1
Hi,

On 08.03.2022 08:55, Jiasheng Jiang wrote:
> As the potential failure of the clk_enable(),
> it should be better to check it and return error
> if fails.

It does not seem to be real issue. More below.


>
> Fixes: 1bce6fb3edf1 ("[media] s5p-mfc: Rework clock handling")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>   drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
> index 88b7d33c9197..392e6fab0a75 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
> @@ -106,10 +106,12 @@ int s5p_mfc_power_on(void)
>   
>   int s5p_mfc_power_off(void)
>   {
> -	int i;
> +	int i, ret;
>   
>   	/* finish software clock gating */
> -	clk_enable(pm->clock_gate);
> +	ret = clk_enable(pm->clock_gate);
> +	if (ret)
> +		return ret;

Here clk_enable is just for balance enable counter for pm->clocks[0]. It 
does not matter if it succeeds, as it will be disabled in next lines.
For sure failure here should not stop power off sequence.

Regards
Andrzej

>   
>   	for (i = 0; i < pm->num_clocks; i++)
>   		clk_disable_unprepare(pm->clocks[i]);
diff mbox series

Patch

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
index 88b7d33c9197..392e6fab0a75 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
@@ -106,10 +106,12 @@  int s5p_mfc_power_on(void)
 
 int s5p_mfc_power_off(void)
 {
-	int i;
+	int i, ret;
 
 	/* finish software clock gating */
-	clk_enable(pm->clock_gate);
+	ret = clk_enable(pm->clock_gate);
+	if (ret)
+		return ret;
 
 	for (i = 0; i < pm->num_clocks; i++)
 		clk_disable_unprepare(pm->clocks[i]);