Mesa (master): nvc0: set ret variable if launch desc allocation failed

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Fri Apr 12 15:18:17 UTC 2013


Module: Mesa
Branch: master
Commit: ac1118d53c0b22db8dcd6fcdcd2d1a245037dbc1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac1118d53c0b22db8dcd6fcdcd2d1a245037dbc1

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Fri Apr 12 00:22:33 2013 +0100

nvc0: set ret variable if launch desc allocation failed

Pointed out by gcc

nve4_compute.c: In function 'nve4_launch_grid':
nve4_compute.c:511:7: warning: 'ret' may be used uninitialized in
 this function [-Wmaybe-uninitialized]
    if (ret)
       ^

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>

Edit by Christoph Bumiller:
Set it to -1 to indicate failure and only when it's actually required.

---

 src/gallium/drivers/nvc0/nve4_compute.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nve4_compute.c b/src/gallium/drivers/nvc0/nve4_compute.c
index 7ea61e8..106fb7a 100644
--- a/src/gallium/drivers/nvc0/nve4_compute.c
+++ b/src/gallium/drivers/nvc0/nve4_compute.c
@@ -469,8 +469,10 @@ nve4_launch_grid(struct pipe_context *pipe,
    int ret;
 
    desc = nve4_compute_alloc_launch_desc(&nvc0->base, &desc_bo, &desc_gpuaddr);
-   if (!desc)
+   if (!desc) {
+      ret = -1;
       goto out;
+   }
    BCTX_REFN_bo(nvc0->bufctx_cp, CP_DESC, NOUVEAU_BO_GART | NOUVEAU_BO_RD,
                 desc_bo);
 




More information about the mesa-commit mailing list