summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl
diff options
context:
space:
mode:
authorEdward O'Callaghan <[email protected]>2015-12-04 22:08:22 +1100
committerMarek Olšák <[email protected]>2015-12-06 17:10:23 +0100
commit13eb5f596bc8ece3d1805b388aa53917e6158d7b (patch)
treeda4ab5c8fd897b317d7f66004fdd22cd02ebe84c /src/gallium/drivers/virgl
parent150c289f6067cb1ba4572f9124948a94ef94c839 (diff)
gallium/drivers: Sanitize NULL checks into canonical form
Use NULL tests of the form `if (ptr)' or `if (!ptr)'. They do not depend on the definition of the symbol NULL. Further, they provide the opportunity for the accidental assignment, are clear and succinct. Signed-off-by: Edward O'Callaghan <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl')
-rw-r--r--src/gallium/drivers/virgl/virgl_buffer.c2
-rw-r--r--src/gallium/drivers/virgl/virgl_context.c4
-rw-r--r--src/gallium/drivers/virgl/virgl_texture.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c
index ce19fb949d0..94034072439 100644
--- a/src/gallium/drivers/virgl/virgl_buffer.c
+++ b/src/gallium/drivers/virgl/virgl_buffer.c
@@ -63,7 +63,7 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx,
ctx->flush(ctx, NULL, 0);
trans = util_slab_alloc(&vctx->texture_transfer_pool);
- if (trans == NULL)
+ if (!trans)
return NULL;
trans->base.resource = resource;
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index e4f02ba1096..527f7637cb6 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -198,7 +198,7 @@ static struct pipe_surface *virgl_create_surface(struct pipe_context *ctx,
uint32_t handle;
surf = CALLOC_STRUCT(virgl_surface);
- if (surf == NULL)
+ if (!surf)
return NULL;
res->clean = FALSE;
@@ -669,7 +669,7 @@ static struct pipe_sampler_view *virgl_create_sampler_view(struct pipe_context *
uint32_t handle;
struct virgl_resource *res;
- if (state == NULL)
+ if (!state)
return NULL;
grview = CALLOC_STRUCT(virgl_sampler_view);
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index 31189626144..f395f1f4a66 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -146,7 +146,7 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx,
ctx->flush(ctx, NULL, 0);
trans = util_slab_alloc(&vctx->texture_transfer_pool);
- if (trans == NULL)
+ if (!trans)
return NULL;
trans->base.resource = resource;