diff mbox series

PM / devfreq: mediatek: Fix unnecessary check of drvdata

Message ID 20220620154347.14756-1-matthias.bgg@kernel.org
State New
Headers show
Series PM / devfreq: mediatek: Fix unnecessary check of drvdata | expand

Commit Message

Matthias Brugger June 20, 2022, 3:43 p.m. UTC
From: Matthias Brugger <matthias.bgg@gmail.com>

Probe function will error out if drvdata 'mtk_ccifreq_drv' is null.
So when mtk_ccifreq_target get's called, the drv pointer will never be
NULL. This fixes a static checker warning.

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
 drivers/devfreq/mtk-cci-devfreq.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

AngeloGioacchino Del Regno June 21, 2022, 7:31 a.m. UTC | #1
Il 20/06/22 17:43, matthias.bgg@kernel.org ha scritto:
> From: Matthias Brugger <matthias.bgg@gmail.com>
> 
> Probe function will error out if drvdata 'mtk_ccifreq_drv' is null.
> So when mtk_ccifreq_target get's called, the drv pointer will never be
> NULL. This fixes a static checker warning.
> 
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Johnson Wang June 21, 2022, 8:26 a.m. UTC | #2
On Mon, 2022-06-20 at 17:43 +0200, matthias.bgg@kernel.org wrote:
> From: Matthias Brugger <matthias.bgg@gmail.com>
> 
> Probe function will error out if drvdata 'mtk_ccifreq_drv' is null.
> So when mtk_ccifreq_target get's called, the drv pointer will never
> be
> NULL. This fixes a static checker warning.
> 
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
>  drivers/devfreq/mtk-cci-devfreq.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-
> cci-devfreq.c
> index 71abb3fbd042..ad05b152071d 100644
> --- a/drivers/devfreq/mtk-cci-devfreq.c
> +++ b/drivers/devfreq/mtk-cci-devfreq.c
> @@ -132,9 +132,6 @@ static int mtk_ccifreq_target(struct device *dev,
> unsigned long *freq,
>  	unsigned long opp_rate;
>  	int voltage, pre_voltage, inter_voltage, target_voltage, ret;
>  
> -	if (!drv)
> -		return -EINVAL;
> -
>  	if (drv->pre_freq == *freq)
>  		return 0;
>  

Hi Matthias,

Thank you for improving this driver.
I've tested this patch on the MT8183 and MT8186 platforms.

Tested-by: Johnson Wang <johnson.wang@mediatek.com>

BRs,
Johnson Wang
diff mbox series

Patch

diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c
index 71abb3fbd042..ad05b152071d 100644
--- a/drivers/devfreq/mtk-cci-devfreq.c
+++ b/drivers/devfreq/mtk-cci-devfreq.c
@@ -132,9 +132,6 @@  static int mtk_ccifreq_target(struct device *dev, unsigned long *freq,
 	unsigned long opp_rate;
 	int voltage, pre_voltage, inter_voltage, target_voltage, ret;
 
-	if (!drv)
-		return -EINVAL;
-
 	if (drv->pre_freq == *freq)
 		return 0;