[PATCH xf86-video-ati 13/21] Replace 'foo == NULL' with '!foo'

Michel Dänzer michel at daenzer.net
Wed Jul 11 17:27:58 UTC 2018


From: Michel Dänzer <michel.daenzer at amd.com>

Shorter and sweeter. :)

(Ported from amdgpu commit e8e688f3852fb06b0c34ed5bce47c9493bcd1613)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/ati.c                    |  4 ++--
 src/drmmode_display.c        |  8 ++++----
 src/evergreen_exa.c          | 10 +++++-----
 src/r600_exa.c               | 10 +++++-----
 src/radeon.h                 |  2 +-
 src/radeon_dri2.c            | 12 ++++++------
 src/radeon_exa.c             |  2 +-
 src/radeon_exa_funcs.c       |  8 ++++----
 src/radeon_exa_render.c      |  6 +++---
 src/radeon_glamor.c          |  2 +-
 src/radeon_glamor_wrappers.c |  4 ++--
 src/radeon_kms.c             | 25 ++++++++++++-------------
 src/radeon_textured_video.c  | 10 +++++-----
 src/radeon_video.c           |  6 +++---
 14 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/src/ati.c b/src/ati.c
index 6fd215679..837b00942 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -109,7 +109,7 @@ ati_device_get_primary(void)
 
     device_iter = pci_slot_match_iterator_create(NULL);
 
-    while ((device = pci_device_next(device_iter)) != NULL) {
+    while ((device = pci_device_next(device_iter))) {
         if (xf86IsPrimaryPci(device))
             break;
     }
@@ -128,7 +128,7 @@ ati_device_get_indexed(int index)
 
     device_iter = pci_slot_match_iterator_create(NULL);
 
-    while ((device = pci_device_next(device_iter)) != NULL) {
+    while ((device = pci_device_next(device_iter))) {
         if (device->vendor_id == PCI_VENDOR_ATI) {
             if (count == index)
                 return device;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 003fe51ef..3117b8f18 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -386,7 +386,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 	    return pixmap;
 
 	fbcon = drmModeGetFB(pRADEONEnt->fd, fbcon_id);
-	if (fbcon == NULL)
+	if (!fbcon)
 		return NULL;
 
 	if (fbcon->depth != pScrn->depth ||
@@ -410,7 +410,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 	bo->ref_count = 1;
 
 	bo->bo.radeon = radeon_bo_open(drmmode->bufmgr, flink.name, 0, 0, 0, 0);
-	if (bo == NULL) {
+	if (!bo) {
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Couldn't open BO for fbcon handle\n");
 		goto out_free_fb;
@@ -1365,7 +1365,7 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res
 	RADEONInfoPtr info = RADEONPTR(pScrn);
 
 	crtc = xf86CrtcCreate(pScrn, &info->drmmode_crtc_funcs);
-	if (crtc == NULL)
+	if (!crtc)
 		return 0;
 
 	drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
@@ -2317,7 +2317,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 		if (radeon_bo_map(info->front_buffer->bo.radeon, 1))
 			goto fail;
 		fb_shadow = calloc(1, pitch * scrn->virtualY);
-		if (fb_shadow == NULL)
+		if (!fb_shadow)
 			goto fail;
 		free(info->fb_shadow);
 		info->fb_shadow = fb_shadow;
diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
index dae8b6a15..447ed217c 100644
--- a/src/evergreen_exa.c
+++ b/src/evergreen_exa.c
@@ -511,7 +511,7 @@ EVERGREENPrepareCopy(PixmapPtr pSrc,   PixmapPtr pDst,
 	accel_state->copy_area_bo = radeon_bo_open(info->bufmgr, 0, size, 0,
 						   RADEON_GEM_DOMAIN_VRAM,
 						   0);
-	if (accel_state->copy_area_bo == NULL)
+	if (!accel_state->copy_area_bo)
 	    RADEON_FALLBACK(("temp copy surface alloc failed\n"));
 
 	radeon_cs_space_add_persistent_bo(info->cs, accel_state->copy_area_bo,
@@ -1693,7 +1693,7 @@ EVERGREENUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
 
@@ -1821,7 +1821,7 @@ EVERGREENDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -1927,7 +1927,7 @@ EVERGREENAllocShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen)
 
     accel_state->shaders_bo = radeon_bo_open(info->bufmgr, 0, size, 0,
 					     RADEON_GEM_DOMAIN_VRAM, 0);
-    if (accel_state->shaders_bo == NULL) {
+    if (!accel_state->shaders_bo) {
 	ErrorF("Allocating shader failed\n");
 	return FALSE;
     }
@@ -2046,7 +2046,7 @@ EVERGREENDrawInit(ScreenPtr pScreen)
     ScrnInfoPtr pScrn =  xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info   = RADEONPTR(pScrn);
 
-    if (info->accel_state->exa == NULL) {
+    if (!info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
 	return FALSE;
     }
diff --git a/src/r600_exa.c b/src/r600_exa.c
index bd824c877..99db0c40b 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -575,7 +575,7 @@ R600PrepareCopy(PixmapPtr pSrc,   PixmapPtr pDst,
 	accel_state->copy_area_bo = radeon_bo_open(info->bufmgr, 0, size, align,
 						   RADEON_GEM_DOMAIN_VRAM,
 						   0);
-	if (accel_state->copy_area_bo == NULL)
+	if (!accel_state->copy_area_bo)
 	    RADEON_FALLBACK(("temp copy surface alloc failed\n"));
 	
 	radeon_cs_space_add_persistent_bo(info->cs, accel_state->copy_area_bo,
@@ -1723,7 +1723,7 @@ R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
 
@@ -1847,7 +1847,7 @@ R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     base_align = drmmode_get_base_align(pScrn, (bpp / 8), 0);
     size = scratch_pitch * height * (bpp / 8);
     scratch = radeon_bo_open(info->bufmgr, 0, size, base_align, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -1960,7 +1960,7 @@ R600AllocShaders(ScrnInfoPtr pScrn, ScreenPtr pScreen)
 
     accel_state->shaders_bo = radeon_bo_open(info->bufmgr, 0, size, 0,
 					     RADEON_GEM_DOMAIN_VRAM, 0);
-    if (accel_state->shaders_bo == NULL) {
+    if (!accel_state->shaders_bo) {
         ErrorF("Allocating shader failed\n");
 	return FALSE;
     }
@@ -2025,7 +2025,7 @@ R600DrawInit(ScreenPtr pScreen)
     ScrnInfoPtr pScrn =  xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info   = RADEONPTR(pScrn);
 
-    if (info->accel_state->exa == NULL) {
+    if (!info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
 	return FALSE;
     }
diff --git a/src/radeon.h b/src/radeon.h
index 2bcfa41b1..450c69aa8 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -726,7 +726,7 @@ static inline Bool radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_buffer *bo
 	struct radeon_pixmap *priv;
 
 	priv = radeon_get_pixmap_private(pPix);
-	if (priv == NULL && bo == NULL)
+	if (!priv && !bo)
 	    return TRUE;
 
 	if (priv) {
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 70ad1d92a..c36e06f22 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -238,14 +238,14 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 	return NULL;
 
     buffers = calloc(1, sizeof *buffers);
-    if (buffers == NULL)
+    if (!buffers)
         goto error;
 
     if (!info->use_glamor) {
 	info->exa_force_create = TRUE;
 	exaMoveInPixmap(pixmap);
 	info->exa_force_create = FALSE;
-	if (exaGetPixmapDriverPrivate(pixmap) == NULL) {
+	if (!exaGetPixmapDriverPrivate(pixmap)) {
 	    /* this happen if pixmap is non accelerable */
 	    goto error;
 	}
@@ -258,7 +258,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,
 	goto error;
 
     privates = calloc(1, sizeof(struct dri2_buffer_priv));
-    if (privates == NULL)
+    if (!privates)
         goto error;
 
     buffers->attachment = attachment;
@@ -923,7 +923,7 @@ static int radeon_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc)
     xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw, TRUE);
 
     /* Drawable not displayed, make up a value */
-    if (crtc == NULL) {
+    if (!crtc) {
         *ust = 0;
         *msc = 0;
         return TRUE;
@@ -1034,7 +1034,7 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,
     remainder &= 0xffffffff;
 
     /* Drawable not visible, return immediately */
-    if (crtc == NULL)
+    if (!crtc)
         goto out_complete;
 
     msc_delta = radeon_get_msc_delta(draw, crtc);
@@ -1193,7 +1193,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
     radeon_dri2_ref_buffer(back);
 
     /* either off-screen or CRTC not usable... just complete the swap */
-    if (crtc == NULL)
+    if (!crtc)
         goto blit_fallback;
 
     msc_delta = radeon_get_msc_delta(draw, crtc);
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 90d92d7b8..93c2f056c 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -150,7 +150,7 @@ Bool RADEONGetPixmapOffsetPitch(PixmapPtr pPix, uint32_t *pitch_offset)
  */
 Bool radeon_transform_is_affine_or_scaled(PictTransformPtr t)
 {
-	if (t == NULL)
+	if (!t)
 		return TRUE;
 	/* the shaders don't handle scaling either */
 	return t->matrix[2][0] == 0 && t->matrix[2][1] == 0 && t->matrix[2][2] == IntToxFixed(1);
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 819b42580..b3200cc97 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -331,7 +331,7 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, struct radeon_bo *src_bo,
 
     if (src_bo && dst_bo) {
         BEGIN_ACCEL_RELOC(6, 2);
-    } else if (src_bo && dst_bo == NULL) {
+    } else if (src_bo && !dst_bo) {
         BEGIN_ACCEL_RELOC(6, 1);
     } else {
         BEGIN_RING(2*6);
@@ -423,7 +423,7 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
 
     size = scratch_pitch * h;
     scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -531,7 +531,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     }
     size = scratch_pitch * h;
     scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
-    if (scratch == NULL) {
+    if (!scratch) {
 	goto copy;
     }
     radeon_cs_space_reset_bos(info->cs);
@@ -584,7 +584,7 @@ Bool RADEONDrawInit(ScreenPtr pScreen)
 {
     RINFO_FROM_SCREEN(pScreen);
 
-    if (info->accel_state->exa == NULL) {
+    if (!info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
 	return FALSE;
     }
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index 9510f7f41..c61d83f4b 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -630,7 +630,7 @@ static Bool R100PrepareComposite(int op,
 	return FALSE;
     pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
 
-    if (pMask != NULL) {
+    if (pMask) {
 	if (!R100TextureSetup(pMaskPicture, pMask, 1))
 	    return FALSE;
 	pp_cntl |= RADEON_TEX_1_ENABLE;
@@ -992,7 +992,7 @@ static Bool R200PrepareComposite(int op, PicturePtr pSrcPicture,
 	return FALSE;
     pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE;
 
-    if (pMask != NULL) {
+    if (pMask) {
 	if (!R200TextureSetup(pMaskPicture, pMask, 1))
 	    return FALSE;
 	pp_cntl |= RADEON_TEX_1_ENABLE;
@@ -1484,7 +1484,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture,
 	return FALSE;
     txenable = R300_TEX_0_ENABLE;
 
-    if (pMask != NULL) {
+    if (pMask) {
 	if (!R300TextureSetup(pMaskPicture, pMask, 1))
 	    return FALSE;
 	txenable |= R300_TEX_1_ENABLE;
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index fa6349472..b649bd18d 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -261,7 +261,7 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		int stride;
 
 		priv = calloc(1, sizeof (struct radeon_pixmap));
-		if (priv == NULL)
+		if (!priv)
 			goto fallback_pixmap;
 
 		priv->bo = radeon_alloc_pixmap_bo(scrn, w, h, depth, usage,
diff --git a/src/radeon_glamor_wrappers.c b/src/radeon_glamor_wrappers.c
index 79d98cc77..edffd9adb 100644
--- a/src/radeon_glamor_wrappers.c
+++ b/src/radeon_glamor_wrappers.c
@@ -132,7 +132,7 @@ radeon_glamor_finish_access_cpu(PixmapPtr pixmap)
 static Bool
 radeon_glamor_prepare_access_gpu(struct radeon_pixmap *priv)
 {
-	return priv != NULL;
+	return !!priv;
 }
 
 static void
@@ -201,7 +201,7 @@ radeon_glamor_picture_prepare_access_cpu_ro(ScrnInfoPtr scrn,
 	PixmapPtr pixmap;
 	struct radeon_pixmap *priv;
 
-	if (picture->pDrawable == NULL)
+	if (!picture->pDrawable)
 		return TRUE;
 
 	pixmap = get_drawable_pixmap(picture->pDrawable);
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 15dca0de4..36840ad36 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -639,7 +639,7 @@ master_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
     ScreenPtr master_screen = radeon_dirty_master(dirty);
 
-    return master_screen->SyncSharedPixmap != NULL;
+    return !!master_screen->SyncSharedPixmap;
 }
 
 static Bool
@@ -647,7 +647,7 @@ slave_has_sync_shared_pixmap(ScrnInfoPtr scrn, PixmapDirtyUpdatePtr dirty)
 {
     ScreenPtr slave_screen = dirty->slave_dst->drawable.pScreen;
 
-    return slave_screen->SyncSharedPixmap != NULL;
+    return !!slave_screen->SyncSharedPixmap;
 }
 
 static void
@@ -1769,7 +1769,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
     info->dri2.available = FALSE;
     info->dri2.enabled = FALSE;
     info->dri2.pKernelDRMVersion = drmGetVersion(pRADEONEnt->fd);
-    if (info->dri2.pKernelDRMVersion == NULL) {
+    if (!info->dri2.pKernelDRMVersion) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "RADEONDRIGetVersion failed to get the DRM version\n");
 	return FALSE;
@@ -1924,7 +1924,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	    xf86OutputPtr output = xf86_config->output[i];
 
 	    /* XXX: double check crtc mode */
-	    if ((output->probed_modes != NULL) && (output->crtc == NULL))
+	    if (output->probed_modes && !output->crtc)
 		output->crtc = xf86_config->crtc[0];
 	}
     }
@@ -1987,7 +1987,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL
+    if (!pScrn->modes
 #ifdef XSERVER_PLATFORM_BUS
         && !pScrn->is_gpu
 #endif
@@ -2098,7 +2098,7 @@ static Bool RADEONSaveScreen_KMS(ScreenPtr pScreen, int mode)
     unblank = xf86IsUnblank(mode);
     if (unblank) SetTimeSinceLastInputEvent();
 
-    if ((pScrn != NULL) && pScrn->vtSema) {
+    if (pScrn && pScrn->vtSema) {
 	if (unblank)
 	    RADEONUnblank(pScrn);
 	else
@@ -2287,7 +2287,7 @@ Bool RADEONScreenInit_KMS(ScreenPtr pScreen, int argc, char **argv)
 	info->fb_shadow = calloc(1,
 				 pScrn->displayWidth * pScrn->virtualY *
 				 ((pScrn->bitsPerPixel + 7) >> 3));
-	if (info->fb_shadow == NULL) {
+	if (!info->fb_shadow) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                        "Failed to allocate shadow framebuffer\n");
 	    return FALSE;
@@ -2689,13 +2689,13 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
     int pitch;
     uint32_t tiling_flags = 0;
 
-    if (info->accel_state->exa != NULL) {
+    if (info->accel_state->exa) {
 	xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map already initialized\n");
 	return FALSE;
     }
     if (!info->use_glamor && info->r600_shadow_fb == FALSE) {
         info->accel_state->exa = exaDriverAlloc();
-        if (info->accel_state->exa == NULL) {
+        if (!info->accel_state->exa) {
 	    xf86DrvMsg(pScreen->myNum, X_ERROR, "exaDriverAlloc failed\n");
 	    return FALSE;
 	}
@@ -2709,7 +2709,7 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	cursor_size = RADEON_ALIGN(cursor_size, RADEON_GPU_PAGE_SIZE);
 	for (c = 0; c < xf86_config->num_crtc; c++) {
 	    /* cursor objects */
-            if (info->cursor_bo[c] == NULL) {
+            if (!info->cursor_bo[c]) {
                 info->cursor_bo[c] = radeon_bo_open(info->bufmgr, 0,
                                                     cursor_size, 0,
                                                     RADEON_GEM_DOMAIN_VRAM, 0);
@@ -2727,7 +2727,7 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
         }
     }
 
-    if (info->front_buffer == NULL) {
+    if (!info->front_buffer) {
 	int usage = CREATE_PIXMAP_USAGE_BACKING_PIXMAP;
 
 	if (info->allowColorTiling && !info->shadow_primary) {
@@ -2787,9 +2787,8 @@ void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, uint32_t new_fb_size)
     int c;
 
     for (c = 0; c < xf86_config->num_crtc; c++) {
-	if (info->cursor_bo[c] != NULL) {
+	if (info->cursor_bo[c])
 	    new_fb_size += (64 * 4 * 64);
-	}
     }
 
     remain_size_bytes = info->vram_size - new_fb_size;
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 23bdfd1dc..be71e4086 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -153,7 +153,7 @@ radeon_allocate_video_bo(ScrnInfoPtr pScrn,
 static void
 RADEONFreeVideoMemory(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
 {
-    if (pPriv->video_memory != NULL) {
+    if (pPriv->video_memory) {
 	radeon_bo_unref(pPriv->video_memory);
 	pPriv->video_memory = NULL;
 
@@ -312,7 +312,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
 	RADEONFreeVideoMemory(pScrn, pPriv);
     }
 
-    if (pPriv->video_memory == NULL) {
+    if (!pPriv->video_memory) {
       Bool ret;
       ret = radeon_allocate_video_bo(pScrn,
 				     &pPriv->video_memory,
@@ -329,7 +329,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
 
     /* Bicubic filter loading */
     if (pPriv->bicubic_enabled) {
-	if (info->bicubic_bo == NULL)
+	if (!info->bicubic_bo)
 	    pPriv->bicubic_enabled = FALSE;
     }
 
@@ -725,7 +725,7 @@ static void radeon_unload_bicubic_texture(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr    info = RADEONPTR(pScrn);
 
-    if (info->bicubic_memory != NULL) {
+    if (info->bicubic_memory) {
 	radeon_bo_unref(info->bicubic_memory);
 	info->bicubic_memory = NULL;
     }
@@ -827,7 +827,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
 
     adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports *
 		   (sizeof(RADEONPortPrivRec) + sizeof(DevUnion)));
-    if (adapt == NULL)
+    if (!adapt)
 	return NULL;
 
     xvBicubic         = MAKE_ATOM("XV_BICUBIC");
diff --git a/src/radeon_video.c b/src/radeon_video.c
index e08d8e005..fc3211842 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -144,7 +144,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 
     num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
     newAdaptors = malloc((num_adaptors + 2) * sizeof(*newAdaptors));
-    if (newAdaptors == NULL)
+    if (!newAdaptors)
 	return;
 
     memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
@@ -152,7 +152,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 
     if (info->use_glamor) {
         texturedAdaptor = radeon_glamor_xv_init(pScreen, 16);
-	if (texturedAdaptor != NULL) {
+	if (texturedAdaptor) {
 	    adaptors[num_adaptors++] = texturedAdaptor;
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video (glamor)\n");
 	} else
@@ -161,7 +161,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
 	|| (info->directRenderingEnabled)
 	) {
 	texturedAdaptor = RADEONSetupImageTexturedVideo(pScreen);
-	if (texturedAdaptor != NULL) {
+	if (texturedAdaptor) {
 	    adaptors[num_adaptors++] = texturedAdaptor;
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video\n");
 	} else
-- 
2.18.0



More information about the amd-gfx mailing list