drm/etnaviv: fix error code in event_alloc()
Subsystems (3)
PATCH 1/1 drm/etnaviv: fix error code in event_alloc()
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.
Fixes f098f9b8042a ("drm/etnaviv: move runtime PM handling to events")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +4 -4
@@ -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);
Signature · 1 line
2.39.2
Lucas Stach
maintainerHi Dan,
Am Mittwoch, dem 19.07.2023 um 13:17 +0300 schrieb Dan Carpenter:
Quoted 4 lines
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
Quoted 33 lines
Fixes f098f9b8042a ("drm/etnaviv: move runtime PM handling to events")Signed-off-by Dan Carpenter <[email protected]>--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/etnaviv/etnaviv_gpu.c +4
-4@@ -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);