summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/gallium/drivers/i915/i915_context.c2
-rw-r--r--src/gallium/drivers/i915/i915_resource_buffer.c2
-rw-r--r--src/gallium/drivers/i915/i915_resource_texture.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene_queue.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_gs.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_rasterizer.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_setup.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_vs.c2
-rw-r--r--src/gallium/drivers/noop/noop_pipe.c8
-rw-r--r--src/gallium/drivers/noop/noop_state.c16
-rw-r--r--src/gallium/drivers/nouveau/nouveau_compiler.c2
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv84_video_vp.c4
-rw-r--r--src/gallium/drivers/r300/compiler/r3xx_vertprog.c2
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c2
-rw-r--r--src/gallium/drivers/r300/r300_state.c6
-rw-r--r--src/gallium/drivers/r600/compute_memory_pool.c6
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c8
-rw-r--r--src/gallium/drivers/r600/r600_asm.c18
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c6
-rw-r--r--src/gallium/drivers/r600/r600_state.c8
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c6
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c2
-rw-r--r--src/gallium/drivers/radeon/r600_query.c2
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c8
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c6
-rw-r--r--src/gallium/drivers/radeonsi/si_pm4.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c16
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c12
-rw-r--r--src/gallium/drivers/softpipe/sp_state_shader.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c2
-rw-r--r--src/gallium/drivers/svga/svga_cmd.c6
-rw-r--r--src/gallium/drivers/svga/svga_context.c4
-rw-r--r--src/gallium/drivers/svga/svga_draw.c8
-rw-r--r--src/gallium/drivers/svga/svga_draw_arrays.c4
-rw-r--r--src/gallium/drivers/svga/svga_draw_elements.c6
-rw-r--r--src/gallium/drivers/svga/svga_pipe_clear.c4
-rw-r--r--src/gallium/drivers/svga/svga_pipe_query.c10
-rw-r--r--src/gallium/drivers/svga/svga_pipe_streamout.c2
-rw-r--r--src/gallium/drivers/svga/svga_resource_buffer.c2
-rw-r--r--src/gallium/drivers/svga/svga_resource_texture.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_constants.c8
-rw-r--r--src/gallium/drivers/svga/svga_state_framebuffer.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_gs.c6
-rw-r--r--src/gallium/drivers/svga/svga_state_tgsi_transform.c12
-rw-r--r--src/gallium/drivers/svga/svga_surface.c2
-rw-r--r--src/gallium/drivers/svga/svga_tgsi.c4
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_vgpu10.c2
-rw-r--r--src/gallium/drivers/vc4/vc4_context.c2
-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
54 files changed, 132 insertions, 132 deletions
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 05f8e93ddea..82798bbb543 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -160,7 +160,7 @@ i915_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
struct i915_context *i915;
i915 = CALLOC_STRUCT(i915_context);
- if (i915 == NULL)
+ if (!i915)
return NULL;
i915->iws = i915_screen(screen)->iws;
diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c
index 9fb3855a37e..fb2e53b014f 100644
--- a/src/gallium/drivers/i915/i915_resource_buffer.c
+++ b/src/gallium/drivers/i915/i915_resource_buffer.c
@@ -72,7 +72,7 @@ i915_buffer_transfer_map(struct pipe_context *pipe,
struct i915_buffer *buffer = i915_buffer(resource);
struct pipe_transfer *transfer = util_slab_alloc(&i915->transfer_pool);
- if (transfer == NULL)
+ if (!transfer)
return NULL;
transfer->resource = resource;
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index 9a3279ccb75..03cdcf1c990 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -728,7 +728,7 @@ i915_texture_transfer_map(struct pipe_context *pipe,
unsigned offset;
char *map;
- if (transfer == NULL)
+ if (!transfer)
return NULL;
transfer->b.resource = resource;
@@ -774,7 +774,7 @@ i915_texture_transfer_map(struct pipe_context *pipe,
map = iws->buffer_map(iws, tex->buffer,
(transfer->b.usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE);
- if (map == NULL) {
+ if (!map) {
pipe_resource_reference(&transfer->staging_texture, NULL);
FREE(transfer);
return NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 2441b3c0d88..223be931e05 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -337,7 +337,7 @@ lp_scene_new_data_block( struct lp_scene *scene )
}
else {
struct data_block *block = MALLOC_STRUCT(data_block);
- if (block == NULL)
+ if (!block)
return NULL;
scene->scene_size += sizeof *block;
diff --git a/src/gallium/drivers/llvmpipe/lp_scene_queue.c b/src/gallium/drivers/llvmpipe/lp_scene_queue.c
index 975db43c4e9..debc7a6fe18 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene_queue.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene_queue.c
@@ -60,7 +60,7 @@ struct lp_scene_queue *
lp_scene_queue_create(void)
{
struct lp_scene_queue *queue = CALLOC_STRUCT(lp_scene_queue);
- if (queue == NULL)
+ if (!queue)
return NULL;
queue->ring = util_ringbuffer_create( MAX_SCENE_QUEUE *
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 2c9d43fb040..b1671dd0ae2 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -96,7 +96,7 @@ lp_setup_alloc_triangle(struct lp_scene *scene,
plane_sz);
tri = lp_scene_alloc_aligned( scene, *tri_size, 16 );
- if (tri == NULL)
+ if (!tri)
return NULL;
tri->inputs.stride = input_array_sz;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_gs.c b/src/gallium/drivers/llvmpipe/lp_state_gs.c
index 7ea7a390669..405a415624e 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_gs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_gs.c
@@ -47,7 +47,7 @@ llvmpipe_create_gs_state(struct pipe_context *pipe,
struct lp_geometry_shader *state;
state = CALLOC_STRUCT(lp_geometry_shader);
- if (state == NULL )
+ if (!state)
goto no_state;
/* debug */
diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
index 94ebf8ffffb..ef6958d99fe 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
@@ -64,7 +64,7 @@ llvmpipe_create_rasterizer_state(struct pipe_context *pipe,
* handle, and what we'll look after ourselves.
*/
struct lp_rast_state *state = MALLOC_STRUCT(lp_rast_state);
- if (state == NULL)
+ if (!state)
return NULL;
memcpy(&state->draw_state, rast, sizeof *rast);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c
index 6397b5196d0..64215be91af 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c
@@ -723,7 +723,7 @@ generate_setup_variant(struct lp_setup_variant_key *key,
goto fail;
variant = CALLOC_STRUCT(lp_setup_variant);
- if (variant == NULL)
+ if (!variant)
goto fail;
variant->no = setup_no++;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_vs.c b/src/gallium/drivers/llvmpipe/lp_state_vs.c
index 826ee5b72b1..96a00189b55 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_vs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_vs.c
@@ -46,7 +46,7 @@ llvmpipe_create_vs_state(struct pipe_context *pipe,
struct draw_vertex_shader *vs;
vs = draw_create_vertex_shader(llvmpipe->draw, templ);
- if (vs == NULL) {
+ if (!vs) {
return NULL;
}
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index e644685123e..165284a90bf 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -96,7 +96,7 @@ static struct pipe_resource *noop_resource_create(struct pipe_screen *screen,
unsigned stride;
nresource = CALLOC_STRUCT(noop_resource);
- if (nresource == NULL)
+ if (!nresource)
return NULL;
stride = util_format_get_stride(templ->format, templ->width0);
@@ -158,7 +158,7 @@ static void *noop_transfer_map(struct pipe_context *pipe,
struct noop_resource *nresource = (struct noop_resource *)resource;
transfer = CALLOC_STRUCT(pipe_transfer);
- if (transfer == NULL)
+ if (!transfer)
return NULL;
pipe_resource_reference(&transfer->resource, resource);
transfer->level = level;
@@ -265,7 +265,7 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen,
{
struct pipe_context *ctx = CALLOC_STRUCT(pipe_context);
- if (ctx == NULL)
+ if (!ctx)
return NULL;
ctx->screen = screen;
ctx->priv = priv;
@@ -374,7 +374,7 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen)
}
noop_screen = CALLOC_STRUCT(noop_pipe_screen);
- if (noop_screen == NULL) {
+ if (!noop_screen) {
return NULL;
}
noop_screen->oscreen = oscreen;
diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c
index 5cb37b656de..fe5b5e4696e 100644
--- a/src/gallium/drivers/noop/noop_state.c
+++ b/src/gallium/drivers/noop/noop_state.c
@@ -44,7 +44,7 @@ static void *noop_create_blend_state(struct pipe_context *ctx,
{
struct pipe_blend_state *nstate = CALLOC_STRUCT(pipe_blend_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
@@ -56,7 +56,7 @@ static void *noop_create_dsa_state(struct pipe_context *ctx,
{
struct pipe_depth_stencil_alpha_state *nstate = CALLOC_STRUCT(pipe_depth_stencil_alpha_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
@@ -68,7 +68,7 @@ static void *noop_create_rs_state(struct pipe_context *ctx,
{
struct pipe_rasterizer_state *nstate = CALLOC_STRUCT(pipe_rasterizer_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
@@ -80,7 +80,7 @@ static void *noop_create_sampler_state(struct pipe_context *ctx,
{
struct pipe_sampler_state *nstate = CALLOC_STRUCT(pipe_sampler_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
@@ -93,7 +93,7 @@ static struct pipe_sampler_view *noop_create_sampler_view(struct pipe_context *c
{
struct pipe_sampler_view *sampler_view = CALLOC_STRUCT(pipe_sampler_view);
- if (sampler_view == NULL)
+ if (!sampler_view)
return NULL;
/* initialize base object */
pipe_resource_reference(&sampler_view->texture, texture);
@@ -108,7 +108,7 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx,
{
struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
- if (surface == NULL)
+ if (!surface)
return NULL;
pipe_reference_init(&surface->reference, 1);
pipe_resource_reference(&surface->texture, texture);
@@ -228,7 +228,7 @@ static void *noop_create_vertex_elements(struct pipe_context *ctx,
{
struct pipe_vertex_element *nstate = CALLOC_STRUCT(pipe_vertex_element);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
@@ -240,7 +240,7 @@ static void *noop_create_shader_state(struct pipe_context *ctx,
{
struct pipe_shader_state *nstate = CALLOC_STRUCT(pipe_shader_state);
- if (nstate == NULL) {
+ if (!nstate) {
return NULL;
}
*nstate = *state;
diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
index 495450b317a..670b0c8b135 100644
--- a/src/gallium/drivers/nouveau/nouveau_compiler.c
+++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
@@ -168,7 +168,7 @@ main(int argc, char *argv[])
else
f = fopen(filename, "r");
- if (f == NULL) {
+ if (!f) {
_debug_printf("Error opening file '%s': %s\n", filename, strerror(errno));
return 1;
}
diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c b/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c
index d98992cedd7..811e0c60f83 100644
--- a/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c
+++ b/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c
@@ -497,9 +497,9 @@ nv84_decoder_vp_mpeg12(struct nv84_decoder *dec,
STATIC_ASSERT(sizeof(struct mpeg12_header) == 0x100);
- if (ref1 == NULL)
+ if (!ref1)
ref1 = dest;
- if (ref2 == NULL)
+ if (!ref2)
ref2 = dest;
bo_refs[1].bo = ref1->interlaced;
bo_refs[2].bo = ref2->interlaced;
diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
index 2ff6db54637..810a79ac1e2 100644
--- a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
+++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c
@@ -847,7 +847,7 @@ static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, voi
if (inst->U.I.SrcReg[i].RelAddr &&
inst->U.I.SrcReg[i].Index < 0) {
/* ARL must precede any indirect addressing. */
- if (lastARL == NULL) {
+ if (!lastARL) {
rc_error(&c->Base, "Vertex shader: Found relative addressing without ARL/ARR.");
return;
}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 6451a2c8df2..e9395738d52 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -129,7 +129,7 @@ r300_buffer_transfer_map( struct pipe_context *context,
map = rws->buffer_map(rbuf->cs_buf, r300->cs, usage);
- if (map == NULL) {
+ if (!map) {
util_slab_free(&r300->pool_transfers, transfer);
return NULL;
}
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index d99d5ae0152..1d78134de6d 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1125,7 +1125,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
struct r300_context* r300 = r300_context(pipe);
struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader;
- if (fs == NULL) {
+ if (!fs) {
r300->fs.state = NULL;
return;
}
@@ -1950,7 +1950,7 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
struct r300_context *r300 = r300_context(pipe);
struct r300_vertex_element_state *velems = state;
- if (velems == NULL) {
+ if (!velems) {
return;
}
@@ -1996,7 +1996,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
struct r300_context* r300 = r300_context(pipe);
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
- if (vs == NULL) {
+ if (!vs) {
r300->vs_state.state = NULL;
return;
}
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index d014b952a3f..93e3ffe256f 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -51,7 +51,7 @@ struct compute_memory_pool* compute_memory_pool_new(
{
struct compute_memory_pool* pool = (struct compute_memory_pool*)
CALLOC(sizeof(struct compute_memory_pool), 1);
- if (pool == NULL)
+ if (!pool)
return NULL;
COMPUTE_DBG(rscreen, "* compute_memory_pool_new()\n");
@@ -399,7 +399,7 @@ int compute_memory_promote_item(struct compute_memory_pool *pool,
list_addtail(&item->link, pool->item_list);
item->start_in_dw = start_in_dw;
- if (src != NULL) {
+ if (src) {
u_box_1d(0, item->size_in_dw * 4, &box);
rctx->b.b.resource_copy_region(pipe,
@@ -630,7 +630,7 @@ struct compute_memory_item* compute_memory_alloc(
new_item = (struct compute_memory_item *)
CALLOC(sizeof(struct compute_memory_item), 1);
- if (new_item == NULL)
+ if (!new_item)
return NULL;
new_item->size_in_dw = size_in_dw;
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 53337615f94..d98885ad154 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -404,7 +404,7 @@ static void *evergreen_create_dsa_state(struct pipe_context *ctx,
unsigned db_depth_control, alpha_test_control, alpha_ref;
struct r600_dsa_state *dsa = CALLOC_STRUCT(r600_dsa_state);
- if (dsa == NULL) {
+ if (!dsa) {
return NULL;
}
@@ -461,7 +461,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx,
float psize_min, psize_max;
struct r600_rasterizer_state *rs = CALLOC_STRUCT(r600_rasterizer_state);
- if (rs == NULL) {
+ if (!rs) {
return NULL;
}
@@ -558,7 +558,7 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx,
struct r600_pipe_sampler_state *ss = CALLOC_STRUCT(r600_pipe_sampler_state);
unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 2 : 0;
- if (ss == NULL) {
+ if (!ss) {
return NULL;
}
@@ -669,7 +669,7 @@ evergreen_create_sampler_view_custom(struct pipe_context *ctx,
unsigned dim, last_layer;
uint64_t va;
- if (view == NULL)
+ if (!view)
return NULL;
/* initialize base object */
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 164b84b3136..cf18f6db907 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -55,7 +55,7 @@ static struct r600_bytecode_cf *r600_bytecode_cf(void)
{
struct r600_bytecode_cf *cf = CALLOC_STRUCT(r600_bytecode_cf);
- if (cf == NULL)
+ if (!cf)
return NULL;
LIST_INITHEAD(&cf->list);
LIST_INITHEAD(&cf->alu);
@@ -68,7 +68,7 @@ static struct r600_bytecode_alu *r600_bytecode_alu(void)
{
struct r600_bytecode_alu *alu = CALLOC_STRUCT(r600_bytecode_alu);
- if (alu == NULL)
+ if (!alu)
return NULL;
LIST_INITHEAD(&alu->list);
return alu;
@@ -78,7 +78,7 @@ static struct r600_bytecode_vtx *r600_bytecode_vtx(void)
{
struct r600_bytecode_vtx *vtx = CALLOC_STRUCT(r600_bytecode_vtx);
- if (vtx == NULL)
+ if (!vtx)
return NULL;
LIST_INITHEAD(&vtx->list);
return vtx;
@@ -88,7 +88,7 @@ static struct r600_bytecode_tex *r600_bytecode_tex(void)
{
struct r600_bytecode_tex *tex = CALLOC_STRUCT(r600_bytecode_tex);
- if (tex == NULL)
+ if (!tex)
return NULL;
LIST_INITHEAD(&tex->list);
return tex;
@@ -157,7 +157,7 @@ int r600_bytecode_add_cf(struct r600_bytecode *bc)
{
struct r600_bytecode_cf *cf = r600_bytecode_cf();
- if (cf == NULL)
+ if (!cf)
return -ENOMEM;
LIST_ADDTAIL(&cf->list, &bc->cf);
if (bc->cf_last) {
@@ -1148,7 +1148,7 @@ int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
struct r600_bytecode_alu *lalu;
int i, r;
- if (nalu == NULL)
+ if (!nalu)
return -ENOMEM;
memcpy(nalu, alu, sizeof(struct r600_bytecode_alu));
@@ -1309,7 +1309,7 @@ int r600_bytecode_add_vtx(struct r600_bytecode *bc, const struct r600_bytecode_v
struct r600_bytecode_vtx *nvtx = r600_bytecode_vtx();
int r;
- if (nvtx == NULL)
+ if (!nvtx)
return -ENOMEM;
memcpy(nvtx, vtx, sizeof(struct r600_bytecode_vtx));
@@ -1361,7 +1361,7 @@ int r600_bytecode_add_tex(struct r600_bytecode *bc, const struct r600_bytecode_t
struct r600_bytecode_tex *ntex = r600_bytecode_tex();
int r;
- if (ntex == NULL)
+ if (!ntex)
return -ENOMEM;
memcpy(ntex, tex, sizeof(struct r600_bytecode_tex));
@@ -2420,7 +2420,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx,
&format, &num_format, &format_comp, &endian);
desc = util_format_description(elements[i].src_format);
- if (desc == NULL) {
+ if (!desc) {
r600_bytecode_clear(&bc);
R600_ERR("unknown format %d\n", elements[i].src_format);
return NULL;
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index bd00dcb642c..a82282f8b87 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -115,7 +115,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen,
struct r600_screen* rscreen = (struct r600_screen *)screen;
struct radeon_winsys *ws = rscreen->b.ws;
- if (rctx == NULL)
+ if (!rctx)
return NULL;
rctx->b.b.screen = screen;
@@ -527,7 +527,7 @@ static void r600_destroy_screen(struct pipe_screen* pscreen)
{
struct r600_screen *rscreen = (struct r600_screen *)pscreen;
- if (rscreen == NULL)
+ if (!rscreen)
return;
if (!rscreen->b.ws->unref(rscreen->b.ws))
@@ -554,7 +554,7 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws)
{
struct r600_screen *rscreen = CALLOC_STRUCT(r600_screen);
- if (rscreen == NULL) {
+ if (!rscreen) {
return NULL;
}
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 1f9ae912d4f..b11cfeab17e 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -390,7 +390,7 @@ static void *r600_create_dsa_state(struct pipe_context *ctx,
unsigned db_depth_control, alpha_test_control, alpha_ref;
struct r600_dsa_state *dsa = CALLOC_STRUCT(r600_dsa_state);
- if (dsa == NULL) {
+ if (!dsa) {
return NULL;
}
@@ -446,7 +446,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
float psize_min, psize_max;
struct r600_rasterizer_state *rs = CALLOC_STRUCT(r600_rasterizer_state);
- if (rs == NULL) {
+ if (!rs) {
return NULL;
}
@@ -559,7 +559,7 @@ static void *r600_create_sampler_state(struct pipe_context *ctx,
struct r600_pipe_sampler_state *ss = CALLOC_STRUCT(r600_pipe_sampler_state);
unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 4 : 0;
- if (ss == NULL) {
+ if (!ss) {
return NULL;
}
@@ -642,7 +642,7 @@ r600_create_sampler_view_custom(struct pipe_context *ctx,
unsigned char swizzle[4], array_mode = 0;
unsigned width, height, depth, offset_level, last_level;
- if (view == NULL)
+ if (!view)
return NULL;
/* initialize base object */
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index e50f24ec02a..0bf4842b6a7 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -192,7 +192,7 @@ static void r600_bind_blend_state(struct pipe_context *ctx, void *state)
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_blend_state *blend = (struct r600_blend_state *)state;
- if (blend == NULL) {
+ if (!blend) {
r600_set_cso_state_with_cb(rctx, &rctx->blend_state, NULL, NULL);
return;
}
@@ -299,7 +299,7 @@ static void r600_bind_dsa_state(struct pipe_context *ctx, void *state)
struct r600_dsa_state *dsa = state;
struct r600_stencil_ref ref;
- if (state == NULL) {
+ if (!state) {
r600_set_cso_state_with_cb(rctx, &rctx->dsa_state, NULL, NULL);
return;
}
@@ -339,7 +339,7 @@ static void r600_bind_rs_state(struct pipe_context *ctx, void *state)
struct r600_rasterizer_state *rs = (struct r600_rasterizer_state *)state;
struct r600_context *rctx = (struct r600_context *)ctx;
- if (state == NULL)
+ if (!state)
return;
rctx->rasterizer = rs;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index f566a299f30..8899ba4d55b 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -318,7 +318,7 @@ void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resour
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
struct r600_resource *rr = (struct r600_resource *)r;
- if (r == NULL) {
+ if (!r) {
return;
}
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index 09eabab0e7d..06b5e501a50 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -202,7 +202,7 @@ static struct pipe_query *r600_query_sw_create(struct pipe_context *ctx,
struct r600_query_sw *query;
query = CALLOC_STRUCT(r600_query_sw);
- if (query == NULL)
+ if (!query)
return NULL;
query->b.type = query_type;
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 88b799d87ee..6515a829b5a 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -699,7 +699,7 @@ r600_texture_create_object(struct pipe_screen *screen,
struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
rtex = CALLOC_STRUCT(r600_texture);
- if (rtex == NULL)
+ if (!rtex)
return NULL;
resource = &rtex->resource;
@@ -1039,7 +1039,7 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx,
}
trans = CALLOC_STRUCT(r600_transfer);
- if (trans == NULL)
+ if (!trans)
return NULL;
trans->transfer.resource = texture;
trans->transfer.level = level;
@@ -1115,7 +1115,7 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx,
/* Create the temporary texture. */
staging = (struct r600_texture*)ctx->screen->resource_create(ctx->screen, &resource);
- if (staging == NULL) {
+ if (!staging) {
R600_ERR("failed to create temporary texture to hold untiled copy\n");
FREE(trans);
return NULL;
@@ -1192,7 +1192,7 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
{
struct r600_surface *surface = CALLOC_STRUCT(r600_surface);
- if (surface == NULL)
+ if (!surface)
return NULL;
assert(templ->u.tex.first_layer <= util_max_layer(texture, templ->u.tex.level));
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 3fa3a9bbd6e..b3719dea252 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -416,7 +416,7 @@ static bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
vb = &sctx->vertex_buffer[ve->vertex_buffer_index];
rbuffer = (struct r600_resource*)vb->buffer;
- if (rbuffer == NULL) {
+ if (!rbuffer) {
memset(desc, 0, 16);
continue;
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 81d809b6b9f..46cb035d74c 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -109,7 +109,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
#endif
int shader, i;
- if (sctx == NULL)
+ if (!sctx)
return NULL;
if (sscreen->b.debug_flags & DBG_CHECK_VM)
@@ -520,7 +520,7 @@ static void si_destroy_screen(struct pipe_screen* pscreen)
{
struct si_screen *sscreen = (struct si_screen *)pscreen;
- if (sscreen == NULL)
+ if (!sscreen)
return;
if (!sscreen->b.ws->unref(sscreen->b.ws))
@@ -611,7 +611,7 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
{
struct si_screen *sscreen = CALLOC_STRUCT(si_screen);
- if (sscreen == NULL) {
+ if (!sscreen) {
return NULL;
}
diff --git a/src/gallium/drivers/radeonsi/si_pm4.c b/src/gallium/drivers/radeonsi/si_pm4.c
index c4ef2e78c50..c3032fc45b5 100644
--- a/src/gallium/drivers/radeonsi/si_pm4.c
+++ b/src/gallium/drivers/radeonsi/si_pm4.c
@@ -115,7 +115,7 @@ void si_pm4_free_state(struct si_context *sctx,
struct si_pm4_state *state,
unsigned idx)
{
- if (state == NULL)
+ if (!state)
return;
if (idx != ~0 && sctx->emitted.array[idx] == state) {
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 5b71389c6aa..9f9f3d6610b 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -356,7 +356,7 @@ static void *si_create_blend_state_mode(struct pipe_context *ctx,
uint32_t color_control = 0;
- if (blend == NULL)
+ if (!blend)
return NULL;
blend->alpha_to_one = state->alpha_to_one;
@@ -681,7 +681,7 @@ static void *si_create_rs_state(struct pipe_context *ctx,
unsigned tmp, i;
float psize_min, psize_max;
- if (rs == NULL) {
+ if (!rs) {
return NULL;
}
@@ -803,7 +803,7 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
(struct si_state_rasterizer*)sctx->queued.named.rasterizer;
struct si_state_rasterizer *rs = (struct si_state_rasterizer *)state;
- if (state == NULL)
+ if (!state)
return;
if (sctx->framebuffer.nr_samples > 1 &&
@@ -897,7 +897,7 @@ static void *si_create_dsa_state(struct pipe_context *ctx,
unsigned db_depth_control;
uint32_t db_stencil_control = 0;
- if (dsa == NULL) {
+ if (!dsa) {
return NULL;
}
@@ -953,7 +953,7 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state)
struct si_context *sctx = (struct si_context *)ctx;
struct si_state_dsa *dsa = state;
- if (state == NULL)
+ if (!state)
return;
si_pm4_bind_state(sctx, dsa, dsa);
@@ -2419,7 +2419,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
uint64_t va;
unsigned last_layer = state->u.tex.last_layer;
- if (view == NULL)
+ if (!view)
return NULL;
/* initialize base object */
@@ -2762,7 +2762,7 @@ static void *si_create_sampler_state(struct pipe_context *ctx,
unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 2 : 0;
unsigned border_color_type, border_color_index = 0;
- if (rstate == NULL) {
+ if (!rstate) {
return NULL;
}
@@ -3291,7 +3291,7 @@ static void si_init_config(struct si_context *sctx)
struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
int i;
- if (pm4 == NULL)
+ if (!pm4)
return;
si_pm4_cmd_begin(pm4, PKT3_CONTEXT_CONTROL);
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index ca6b4be3b0b..4555ca450b6 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -100,7 +100,7 @@ static void si_shader_ls(struct si_shader *shader)
uint64_t va;
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
va = shader->bo->gpu_address;
@@ -136,7 +136,7 @@ static void si_shader_hs(struct si_shader *shader)
uint64_t va;
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
va = shader->bo->gpu_address;
@@ -172,7 +172,7 @@ static void si_shader_es(struct si_shader *shader)
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
va = shader->bo->gpu_address;
@@ -229,7 +229,7 @@ static void si_shader_gs(struct si_shader *shader)
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
if (gs_max_vert_out <= 128) {
@@ -301,7 +301,7 @@ static void si_shader_vs(struct si_shader *shader)
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
/* If this is the GS copy shader, the GS state writes this register.
@@ -394,7 +394,7 @@ static void si_shader_ps(struct si_shader *shader)
pm4 = shader->pm4 = CALLOC_STRUCT(si_pm4_state);
- if (pm4 == NULL)
+ if (!pm4)
return;
for (i = 0; i < info->num_inputs; i++) {
diff --git a/src/gallium/drivers/softpipe/sp_state_shader.c b/src/gallium/drivers/softpipe/sp_state_shader.c
index 8ab2903dced..dce0404de5b 100644
--- a/src/gallium/drivers/softpipe/sp_state_shader.c
+++ b/src/gallium/drivers/softpipe/sp_state_shader.c
@@ -207,7 +207,7 @@ softpipe_create_vs_state(struct pipe_context *pipe,
struct sp_vertex_shader *state;
state = CALLOC_STRUCT(sp_vertex_shader);
- if (state == NULL )
+ if (!state)
goto fail;
/* copy shader tokens, the ones passed in will go away.
@@ -269,7 +269,7 @@ softpipe_create_gs_state(struct pipe_context *pipe,
struct sp_geometry_shader *state;
state = CALLOC_STRUCT(sp_geometry_shader);
- if (state == NULL )
+ if (!state)
goto fail;
state->shader = *templ;
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 3347f5f1883..52df89504b8 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -435,7 +435,7 @@ softpipe_transfer_map(struct pipe_context *pipe,
map = spr->data;
}
- if (map == NULL) {
+ if (!map) {
pipe_resource_reference(&pt->resource, NULL);
FREE(spt);
return NULL;
diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c
index 0e1e332d6cb..10442cb46e7 100644
--- a/src/gallium/drivers/svga/svga_cmd.c
+++ b/src/gallium/drivers/svga/svga_cmd.c
@@ -1386,7 +1386,7 @@ SVGA3D_BeginGBQuery(struct svga_winsys_context *swc,
SVGA_3D_CMD_BEGIN_GB_QUERY,
sizeof *cmd,
1);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
@@ -1466,7 +1466,7 @@ SVGA3D_EndGBQuery(struct svga_winsys_context *swc,
SVGA_3D_CMD_END_GB_QUERY,
sizeof *cmd,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
@@ -1553,7 +1553,7 @@ SVGA3D_WaitForGBQuery(struct svga_winsys_context *swc,
SVGA_3D_CMD_WAIT_FOR_GB_QUERY,
sizeof *cmd,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index f8622b96f45..d407785ddd9 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -134,7 +134,7 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen,
enum pipe_error ret;
svga = CALLOC_STRUCT(svga_context);
- if (svga == NULL)
+ if (!svga)
goto cleanup;
LIST_INITHEAD(&svga->dirty_buffers);
@@ -340,7 +340,7 @@ void svga_context_flush( struct svga_context *svga,
PIPE_TIMEOUT_INFINITE);
}
- if(pfence)
+ if (pfence)
svgascreen->sws->fence_reference(svgascreen->sws, pfence, fence);
svgascreen->sws->fence_reference(svgascreen->sws, &fence, NULL);
diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c
index 9b6451da2f9..cca499a65c7 100644
--- a/src/gallium/drivers/svga/svga_draw.c
+++ b/src/gallium/drivers/svga/svga_draw.c
@@ -48,7 +48,7 @@ struct svga_hwtnl *
svga_hwtnl_create(struct svga_context *svga)
{
struct svga_hwtnl *hwtnl = CALLOC_STRUCT(svga_hwtnl);
- if (hwtnl == NULL)
+ if (!hwtnl)
goto fail;
hwtnl->svga = svga;
@@ -189,7 +189,7 @@ draw_vgpu9(struct svga_hwtnl *hwtnl)
for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
unsigned j = hwtnl->cmd.vdecl_buffer_index[i];
handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer);
- if (handle == NULL)
+ if (!handle)
return PIPE_ERROR_OUT_OF_MEMORY;
vb_handle[i] = handle;
@@ -198,7 +198,7 @@ draw_vgpu9(struct svga_hwtnl *hwtnl)
for (i = 0; i < hwtnl->cmd.prim_count; i++) {
if (hwtnl->cmd.prim_ib[i]) {
handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i]);
- if (handle == NULL)
+ if (!handle)
return PIPE_ERROR_OUT_OF_MEMORY;
}
else
@@ -491,7 +491,7 @@ draw_vgpu10(struct svga_hwtnl *hwtnl,
(void) sbuf; /* silence unused var warning */
ib_handle = svga_buffer_handle(svga, ib);
- if (ib_handle == NULL)
+ if (!ib_handle)
return PIPE_ERROR_OUT_OF_MEMORY;
}
else {
diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c
index acb2e95e747..1bf19e8522e 100644
--- a/src/gallium/drivers/svga/svga_draw_arrays.c
+++ b/src/gallium/drivers/svga/svga_draw_arrays.c
@@ -52,11 +52,11 @@ generate_indices(struct svga_hwtnl *hwtnl,
dst = pipe_buffer_create(pipe->screen, PIPE_BIND_INDEX_BUFFER,
PIPE_USAGE_IMMUTABLE, size);
- if (dst == NULL)
+ if (!dst)
goto fail;
dst_map = pipe_buffer_map(pipe, dst, PIPE_TRANSFER_WRITE, &transfer);
- if (dst_map == NULL)
+ if (!dst_map)
goto fail;
generate(0, nr, dst_map);
diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c
index 0213409ef29..74bfebda18f 100644
--- a/src/gallium/drivers/svga/svga_draw_elements.c
+++ b/src/gallium/drivers/svga/svga_draw_elements.c
@@ -60,15 +60,15 @@ translate_indices(struct svga_hwtnl *hwtnl, struct pipe_resource *src,
dst = pipe_buffer_create(pipe->screen,
PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_DEFAULT, size);
- if (dst == NULL)
+ if (!dst)
goto fail;
src_map = pipe_buffer_map(pipe, src, PIPE_TRANSFER_READ, &src_transfer);
- if (src_map == NULL)
+ if (!src_map)
goto fail;
dst_map = pipe_buffer_map(pipe, dst, PIPE_TRANSFER_WRITE, &dst_transfer);
- if (dst_map == NULL)
+ if (!dst_map)
goto fail;
translate((const char *) src_map + offset, 0, 0, nr, 0, dst_map);
diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c
index bab61780610..c874726b6da 100644
--- a/src/gallium/drivers/svga/svga_pipe_clear.c
+++ b/src/gallium/drivers/svga/svga_pipe_clear.c
@@ -178,7 +178,7 @@ try_clear(struct svga_context *svga,
rtv = svga_validate_surface_view(svga,
svga_surface(fb->cbufs[i]));
- if (rtv == NULL)
+ if (!rtv)
return PIPE_ERROR_OUT_OF_MEMORY;
ret = SVGA3D_vgpu10_ClearRenderTargetView(svga->swc,
@@ -191,7 +191,7 @@ try_clear(struct svga_context *svga,
if (flags & (SVGA3D_CLEAR_DEPTH | SVGA3D_CLEAR_STENCIL)) {
struct pipe_surface *dsv =
svga_validate_surface_view(svga, svga_surface(fb->zsbuf));
- if (dsv == NULL)
+ if (!dsv)
return PIPE_ERROR_OUT_OF_MEMORY;
ret = SVGA3D_vgpu10_ClearDepthStencilView(svga->swc, dsv, flags,
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index 3859050bf18..b67d56c4ccf 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -348,7 +348,7 @@ allocate_query_block_entry(struct svga_context *svga,
if (block_index == -1)
return NULL;
alloc_entry = CALLOC_STRUCT(svga_qmem_alloc_entry);
- if (alloc_entry == NULL)
+ if (!alloc_entry)
return NULL;
alloc_entry->block_index = block_index;
@@ -381,13 +381,13 @@ allocate_query(struct svga_context *svga,
alloc_entry = svga->gb_query_map[type];
- if (alloc_entry == NULL) {
+ if (!alloc_entry) {
/**
* No query memory block has been allocated for this query type,
* allocate one now
*/
alloc_entry = allocate_query_block_entry(svga, len);
- if (alloc_entry == NULL)
+ if (!alloc_entry)
return -1;
svga->gb_query_map[type] = alloc_entry;
}
@@ -398,7 +398,7 @@ allocate_query(struct svga_context *svga,
if (slot_index == -1) {
/* This query memory block is full, allocate another one */
alloc_entry = allocate_query_block_entry(svga, len);
- if (alloc_entry == NULL)
+ if (!alloc_entry)
return -1;
alloc_entry->next = svga->gb_query_map[type];
svga->gb_query_map[type] = alloc_entry;
@@ -753,7 +753,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
struct svga_winsys_screen *sws = svga_screen(svga->pipe.screen)->sws;
struct svga_query *sq;
- if (q == NULL) {
+ if (!q) {
destroy_gb_query_obj(svga);
return;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_streamout.c b/src/gallium/drivers/svga/svga_pipe_streamout.c
index 1da63204428..3f443c44eee 100644
--- a/src/gallium/drivers/svga/svga_pipe_streamout.c
+++ b/src/gallium/drivers/svga/svga_pipe_streamout.c
@@ -75,7 +75,7 @@ svga_create_stream_output(struct svga_context *svga,
/* Allocate the streamout data structure */
streamout = CALLOC_STRUCT(svga_stream_output);
- if (streamout == NULL)
+ if (!streamout)
return NULL;
streamout->info = *info;
diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c
index 449cc149a81..a8ffcc7f680 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer.c
@@ -86,7 +86,7 @@ svga_buffer_transfer_map(struct pipe_context *pipe,
assert(box->depth == 1);
transfer = CALLOC_STRUCT(pipe_transfer);
- if (transfer == NULL) {
+ if (!transfer) {
return NULL;
}
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index 81594777258..4c7aeff92e8 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -506,7 +506,7 @@ svga_texture_transfer_map(struct pipe_context *pipe,
/*
* Make sure we return NULL if the map fails
*/
- if (map == NULL) {
+ if (!map) {
FREE(st);
return map;
}
diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
index c93d2a5e565..2cf41134bd6 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -459,7 +459,7 @@ emit_consts_vgpu9(struct svga_context *svga, unsigned shader)
data = (const float (*)[4])
pipe_buffer_map(&svga->pipe, svga->curr.constbufs[shader][0].buffer,
PIPE_TRANSFER_READ, &transfer);
- if (data == NULL) {
+ if (!data) {
return PIPE_ERROR_OUT_OF_MEMORY;
}
@@ -747,7 +747,7 @@ emit_fs_consts(struct svga_context *svga, unsigned dirty)
/* SVGA_NEW_FS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_FS_CONST_BUFFER
@@ -782,7 +782,7 @@ emit_vs_consts(struct svga_context *svga, unsigned dirty)
/* SVGA_NEW_VS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_VS_CONST_BUFFER
@@ -816,7 +816,7 @@ emit_gs_consts(struct svga_context *svga, unsigned dirty)
/* SVGA_NEW_GS_VARIANT
*/
- if (variant == NULL)
+ if (!variant)
return PIPE_OK;
/* SVGA_NEW_GS_CONST_BUFFER
diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
index 9abacc9fa20..4b0400bf80a 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -196,7 +196,7 @@ emit_fb_vgpu10(struct svga_context *svga)
/* Setup depth stencil view */
if (curr->zsbuf) {
dsv = svga_validate_surface_view(svga, svga_surface(curr->zsbuf));
- if (dsv == NULL) {
+ if (!dsv) {
return PIPE_ERROR_OUT_OF_MEMORY;
}
}
diff --git a/src/gallium/drivers/svga/svga_state_gs.c b/src/gallium/drivers/svga/svga_state_gs.c
index 0b336baee86..618bec248dd 100644
--- a/src/gallium/drivers/svga/svga_state_gs.c
+++ b/src/gallium/drivers/svga/svga_state_gs.c
@@ -72,7 +72,7 @@ compile_gs(struct svga_context *svga,
enum pipe_error ret = PIPE_ERROR;
variant = translate_geometry_program(svga, gs, key);
- if (variant == NULL) {
+ if (!variant) {
/* some problem during translation, try the dummy shader */
const struct tgsi_token *dummy = get_dummy_geometry_shader();
if (!dummy) {
@@ -82,7 +82,7 @@ compile_gs(struct svga_context *svga,
FREE((void *) gs->base.tokens);
gs->base.tokens = dummy;
variant = translate_geometry_program(svga, gs, key);
- if (variant == NULL) {
+ if (!variant) {
return PIPE_ERROR;
}
}
@@ -181,7 +181,7 @@ emit_hw_gs(struct svga_context *svga, unsigned dirty)
if (svga->curr.user_gs)
assert(svga->curr.gs);
- if (gs == NULL) {
+ if (!gs) {
if (svga->state.hw_draw.gs != NULL) {
/** The previous geometry shader is made inactive.
diff --git a/src/gallium/drivers/svga/svga_state_tgsi_transform.c b/src/gallium/drivers/svga/svga_state_tgsi_transform.c
index 023c5862d27..9e643ff49a7 100644
--- a/src/gallium/drivers/svga/svga_state_tgsi_transform.c
+++ b/src/gallium/drivers/svga/svga_state_tgsi_transform.c
@@ -88,13 +88,13 @@ emulate_point_sprite(struct svga_context *svga,
key.gs.aa_point = svga->curr.rast->templ.point_smooth;
- if (orig_gs != NULL) {
+ if (orig_gs) {
/* Check if the original geometry shader has stream output and
* if position is one of the outputs.
*/
streamout = orig_gs->base.stream_output;
- if (streamout != NULL) {
+ if (streamout) {
pos_out_index = streamout->pos_out_index;
key.gs.point_pos_stream_out = pos_out_index != -1;
}
@@ -119,7 +119,7 @@ emulate_point_sprite(struct svga_context *svga,
key.gs.aa_point ?
&aa_point_coord_index : NULL);
- if (new_tokens == NULL) {
+ if (!new_tokens) {
/* if no new tokens are generated for whatever reason, just return */
return NULL;
}
@@ -134,7 +134,7 @@ emulate_point_sprite(struct svga_context *svga,
templ.tokens = new_tokens;
templ.stream_output.num_outputs = 0;
- if (streamout != NULL) {
+ if (streamout) {
templ.stream_output = streamout->info;
/* The tgsi_add_point_sprite utility adds an extra output
* for the original point position for stream output purpose.
@@ -169,7 +169,7 @@ emulate_point_sprite(struct svga_context *svga,
/* Add the new geometry shader to the head of the shader list
* pointed to by the original geometry shader.
*/
- if (orig_gs != NULL) {
+ if (orig_gs) {
gs->base.next = orig_gs->base.next;
orig_gs->base.next = &gs->base;
}
@@ -207,7 +207,7 @@ add_point_sprite_shader(struct svga_context *svga)
vs->base.info.output_semantic_name,
vs->base.info.output_semantic_index);
- if (orig_gs == NULL)
+ if (!orig_gs)
return NULL;
}
else {
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index 9f09311116e..ad06a1d531e 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -357,7 +357,7 @@ create_backed_surface_view(struct svga_context *svga, struct svga_surface *s)
{
struct svga_surface *bs = s->backed;
- if (bs == NULL) {
+ if (!bs) {
struct svga_texture *tex = svga_texture(s->base.texture);
struct pipe_surface *backed_view;
diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c
index 4c16f4313a0..c62d4d671ef 100644
--- a/src/gallium/drivers/svga/svga_tgsi.c
+++ b/src/gallium/drivers/svga/svga_tgsi.c
@@ -71,7 +71,7 @@ svga_shader_expand(struct svga_shader_emitter *emit)
else
new_buf = NULL;
- if (new_buf == NULL) {
+ if (!new_buf) {
emit->ptr = err_buf;
emit->buf = err_buf;
emit->size = sizeof(err_buf);
@@ -229,7 +229,7 @@ svga_tgsi_vgpu9_translate(struct svga_context *svga,
}
variant = svga_new_shader_variant(svga);
- if (variant == NULL)
+ if (!variant)
goto fail;
variant->shader = shader;
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 9b7ab16103f..c979f4a8a56 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -240,7 +240,7 @@ expand(struct svga_shader_emitter_v10 *emit)
else
new_buf = NULL;
- if (new_buf == NULL) {
+ if (!new_buf) {
emit->ptr = err_buf;
emit->buf = err_buf;
emit->size = sizeof(err_buf);
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index 4f3e2263f56..c783e7b2e5a 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -207,7 +207,7 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
vc4_debug &= ~VC4_DEBUG_SHADERDB;
vc4 = rzalloc(NULL, struct vc4_context);
- if (vc4 == NULL)
+ if (!vc4)
return NULL;
struct pipe_context *pctx = &vc4->base;
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;