diff mbox

[v1] PM / devfreq: exynos-nocp : Handle return value of clk_prepare_enable

Message ID 1495191035-15882-1-git-send-email-arvind.yadav.cs@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Arvind Yadav May 19, 2017, 10:50 a.m. UTC
clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/devfreq/event/exynos-nocp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Chanwoo Choi May 23, 2017, 9:43 a.m. UTC | #1
Hi Arvind,

On 2017년 05월 19일 19:50, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/devfreq/event/exynos-nocp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
> index 5c3e7b1..f6e7956 100644
> --- a/drivers/devfreq/event/exynos-nocp.c
> +++ b/drivers/devfreq/event/exynos-nocp.c
> @@ -267,7 +267,11 @@ static int exynos_nocp_probe(struct platform_device *pdev)
>  	}
>  	platform_set_drvdata(pdev, nocp);
>  
> -	clk_prepare_enable(nocp->clk);
> +	ret = clk_prepare_enable(nocp->clk);
> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to prepare ppmu clock\n");
> +		return ret;
> +	}

I already replied from the similar patch. Thanks.

>  
>  	pr_info("exynos-nocp: new NoC Probe device registered: %s\n",
>  			dev_name(dev));
>
Chanwoo Choi May 24, 2017, 1:56 a.m. UTC | #2
On 2017년 05월 23일 18:43, Chanwoo Choi wrote:
> Hi Arvind,
> 
> On 2017년 05월 19일 19:50, Arvind Yadav wrote:
>> clk_prepare_enable() can fail here and we must check its return value.
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>> ---
>>  drivers/devfreq/event/exynos-nocp.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
>> index 5c3e7b1..f6e7956 100644
>> --- a/drivers/devfreq/event/exynos-nocp.c
>> +++ b/drivers/devfreq/event/exynos-nocp.c
>> @@ -267,7 +267,11 @@ static int exynos_nocp_probe(struct platform_device *pdev)
>>  	}
>>  	platform_set_drvdata(pdev, nocp);
>>  
>> -	clk_prepare_enable(nocp->clk);
>> +	ret = clk_prepare_enable(nocp->clk);
>> +	if (ret) {
>> +		dev_err(&pdev->dev, "failed to prepare ppmu clock\n");
>> +		return ret;
>> +	}
> 
> I already replied from the similar patch. Thanks.
> 
>>  
>>  	pr_info("exynos-nocp: new NoC Probe device registered: %s\n",
>>  			dev_name(dev));
>>
> 
> 

I'm missing some point that if there is no clock
this driver initializes 'nocp->clk = NULL;' on 217 line.

Looks good to me.
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
diff mbox

Patch

diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
index 5c3e7b1..f6e7956 100644
--- a/drivers/devfreq/event/exynos-nocp.c
+++ b/drivers/devfreq/event/exynos-nocp.c
@@ -267,7 +267,11 @@  static int exynos_nocp_probe(struct platform_device *pdev)
 	}
 	platform_set_drvdata(pdev, nocp);
 
-	clk_prepare_enable(nocp->clk);
+	ret = clk_prepare_enable(nocp->clk);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to prepare ppmu clock\n");
+		return ret;
+	}
 
 	pr_info("exynos-nocp: new NoC Probe device registered: %s\n",
 			dev_name(dev));