[PATCH] drm/etnaviv: fix error code in event_alloc()

Lucas Stach l.stach at pengutronix.de
Wed Jul 19 10:37:59 UTC 2023


Hi Dan,

Am Mittwoch, dem 19.07.2023 um 13:17 +0300 schrieb Dan Carpenter:
> There are two "ret" variables declared in this function so setting
> "ret = -EBUSY;" sets the wrong one.  The function ends up returning an
> uninitialized variable.
> 
Thanks for the fix. Applied to the etnaviv/next branch where the
offending commit sits right now.

Regards,
Lucas

> Fixes: f098f9b8042a ("drm/etnaviv: move runtime PM handling to events")
> Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index f54f12090685..0382cd91eebf 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -1158,18 +1158,18 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,
>  	int ret;
>  
>  	for (i = 0; i < nr_events; i++) {
> -		unsigned long ret;
> +		unsigned long remaining;
>  
> -		ret = wait_for_completion_timeout(&gpu->event_free, timeout);
> +		remaining = wait_for_completion_timeout(&gpu->event_free, timeout);
>  
> -		if (!ret) {
> +		if (!remaining) {
>  			dev_err(gpu->dev, "wait_for_completion_timeout failed");
>  			ret = -EBUSY;
>  			goto out;
>  		}
>  
>  		acquired++;
> -		timeout = ret;
> +		timeout = remaining;
>  	}
>  
>  	spin_lock(&gpu->event_spinlock);



More information about the dri-devel mailing list