Re: [Mesa-dev] [PATCH v2 1/3] nv50, nvc0: make use of unreachable() when invalid texture target happens

2015-12-14 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

On Mon, Dec 14, 2015 at 11:51 AM, Samuel Pitoiset
 wrote:
> Spotted by Coverity.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/nouveau/nv50/nv50_tex.c | 3 +--
>  src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 4 +---
>  2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c 
> b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
> index 6083ea9..c3f4336 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
> @@ -192,8 +192,7 @@ nv50_create_texture_view(struct pipe_context *pipe,
>tic[2] |= NV50_TIC_2_TARGET_BUFFER | NV50_TIC_2_LINEAR;
>break;
> default:
> -  NOUVEAU_ERR("invalid texture target: %d\n", mt->base.base.target);
> -  return false;
> +  unreachable("unexpected/invalid texture target");
> }
>
> tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c 
> b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
> index 2dd100f..74090ce 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
> @@ -193,9 +193,7 @@ nvc0_create_texture_view(struct pipe_context *pipe,
>tic[2] |= NV50_TIC_2_TARGET_CUBE_ARRAY;
>break;
> default:
> -  NOUVEAU_ERR("unexpected/invalid texture target: %d\n",
> -  mt->base.base.target);
> -  return false;
> +  unreachable("unexpected/invalid texture target");
> }
>
> tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030;
> --
> 2.6.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 1/3] nv50, nvc0: make use of unreachable() when invalid texture target happens

2015-12-14 Thread Samuel Pitoiset
Spotted by Coverity.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/nouveau/nv50/nv50_tex.c | 3 +--
 src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c 
b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
index 6083ea9..c3f4336 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c
@@ -192,8 +192,7 @@ nv50_create_texture_view(struct pipe_context *pipe,
   tic[2] |= NV50_TIC_2_TARGET_BUFFER | NV50_TIC_2_LINEAR;
   break;
default:
-  NOUVEAU_ERR("invalid texture target: %d\n", mt->base.base.target);
-  return false;
+  unreachable("unexpected/invalid texture target");
}
 
tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
index 2dd100f..74090ce 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
@@ -193,9 +193,7 @@ nvc0_create_texture_view(struct pipe_context *pipe,
   tic[2] |= NV50_TIC_2_TARGET_CUBE_ARRAY;
   break;
default:
-  NOUVEAU_ERR("unexpected/invalid texture target: %d\n",
-  mt->base.base.target);
-  return false;
+  unreachable("unexpected/invalid texture target");
}
 
tic[3] = (flags & NV50_TEXVIEW_FILTER_MSAA8) ? 0x2000 : 0x0030;
-- 
2.6.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev