nvc0: check return value of nvc0_screen_resize_tls_area()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 30 Aug 2016 14:45:29 +0000 (16:45 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 30 Aug 2016 16:41:59 +0000 (18:41 +0200)
While we are at it, make it static and change the return values
policy to be consistent.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.h

index 8ff6c5d2cbca3893ea0a11ed87700e988885e622..b683804fe1a16232fb5b9cf41b4ba2b75fc929c3 100644 (file)
@@ -673,7 +673,7 @@ nvc0_screen_init_compute(struct nvc0_screen *screen)
    }
 }
 
-bool
+static int
 nvc0_screen_resize_tls_area(struct nvc0_screen *screen,
                             uint32_t lpos, uint32_t lneg, uint32_t cstack)
 {
@@ -683,7 +683,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,
 
    if (size >= (1 << 20)) {
       NOUVEAU_ERR("requested TLS size too large: 0x%"PRIx64"\n", size);
-      return false;
+      return -1;
    }
 
    size *= (screen->base.device->chipset >= 0xe0) ? 64 : 48; /* max warps */
@@ -694,13 +694,11 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,
 
    ret = nouveau_bo_new(screen->base.device, NV_VRAM_DOMAIN(&screen->base), 1 << 17, size,
                         NULL, &bo);
-   if (ret) {
-      NOUVEAU_ERR("failed to allocate TLS area, size: 0x%"PRIx64"\n", size);
-      return false;
-   }
+   if (ret)
+      return ret;
    nouveau_bo_ref(NULL, &screen->tls);
    screen->tls = bo;
-   return true;
+   return 0;
 }
 
 #define FAIL_SCREEN_INIT(str, err)                    \
@@ -1042,7 +1040,9 @@ nvc0_screen_create(struct nouveau_device *dev)
    screen->mp_count = value >> 8;
    screen->mp_count_compute = screen->mp_count;
 
-   nvc0_screen_resize_tls_area(screen, 128 * 16, 0, 0x200);
+   ret = nvc0_screen_resize_tls_area(screen, 128 * 16, 0, 0x200);
+   if (ret)
+      FAIL_SCREEN_INIT("Error allocating TLS area: %d\n", ret);
 
    BEGIN_NVC0(push, NVC0_3D(CODE_ADDRESS_HIGH), 2);
    PUSH_DATAh(push, screen->text->offset);
index 4a89794853fe20d52e00b97301622a8c62cf889a..672d515de2b00f1db84e245314136ee0f058ee67 100644 (file)
@@ -136,9 +136,6 @@ int nvc0_screen_tsc_alloc(struct nvc0_screen *, void *);
 int nve4_screen_compute_setup(struct nvc0_screen *, struct nouveau_pushbuf *);
 int nvc0_screen_compute_setup(struct nvc0_screen *, struct nouveau_pushbuf *);
 
-bool nvc0_screen_resize_tls_area(struct nvc0_screen *, uint32_t lpos,
-                                 uint32_t lneg, uint32_t cstack);
-
 static inline void
 nvc0_resource_fence(struct nv04_resource *res, uint32_t flags)
 {