[PATCH v2] drm/msm/dpu: clean up dpu_kms_get_clk_rate() returns

Abhinav Kumar quic_abhinavk at quicinc.com
Thu Jun 1 16:49:22 UTC 2023



On 5/26/2023 4:51 AM, Dan Carpenter wrote:
> Static analysis tools complain about the -EINVAL error code being
> stored in an unsigned variable.  Let's change this to match
> the clk_get_rate() function which is type unsigned long and returns
> zero on error.
> 
> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
> ---
> v2: In v1 I change the type to int which was wrong.  This is a different
>      approach.  CC the freedreno list this time too.
> 
>   drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++--
>   drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 0e7a68714e9e..25e6a15eaf9f 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -979,13 +979,13 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)
>   	return 0;
>   }
>   
> -u64 dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char *clock_name)
> +unsigned long dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char *clock_name)
>   {
>   	struct clk *clk;
>   
>   	clk = msm_clk_bulk_get_clock(dpu_kms->clocks, dpu_kms->num_clocks, clock_name);
>   	if (!clk)
> -		return -EINVAL;
> +		return 0;
>   

Currently, the only caller of this API is 
dpu_encoder_phys_cmd_tearcheck_config which seems to handle <=0 so this 
change should be fine. Hence


Reviewed-by: Abhinav Kumar <quic_abhinavk at quicinc.com>


More information about the dri-devel mailing list