summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-05-16 16:49:20 +0200
committerMichel Dänzer <michel@daenzer.net>2018-05-16 16:49:20 +0200
commite8e688f3852fb06b0c34ed5bce47c9493bcd1613 (patch)
treee57f99be5862d05a5b83d0f8187ccb4b5fcc69e9
parent103bd6f44cc5f1a6cd6cc9a5cb34d0419c4cece9 (diff)
Replace 'foo == NULL' with '!foo'
Shorter and sweeter. :) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_bo_helper.c10
-rw-r--r--src/amdgpu_dri2.c10
-rw-r--r--src/amdgpu_glamor.c2
-rw-r--r--src/amdgpu_glamor_wrappers.c2
-rw-r--r--src/amdgpu_kms.c8
-rw-r--r--src/amdgpu_pixmap.c2
-rw-r--r--src/amdgpu_pixmap.h2
-rw-r--r--src/amdgpu_video.c2
-rw-r--r--src/drmmode_display.c8
9 files changed, 22 insertions, 24 deletions
diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c
index 34880ff..98eb04a 100644
--- a/src/amdgpu_bo_helper.c
+++ b/src/amdgpu_bo_helper.c
@@ -252,7 +252,7 @@ int amdgpu_bo_map(ScrnInfoPtr pScrn, struct amdgpu_buffer *bo)
PROT_READ | PROT_WRITE, MAP_SHARED,
fd, args.out.addr_ptr);
- if (ptr == NULL) {
+ if (!ptr) {
ErrorF("Failed to mmap the bo\n");
return -1;
}
@@ -266,7 +266,7 @@ int amdgpu_bo_map(ScrnInfoPtr pScrn, struct amdgpu_buffer *bo)
void amdgpu_bo_unmap(struct amdgpu_buffer *bo)
{
- if (bo->cpu_ptr == NULL)
+ if (!bo->cpu_ptr)
return;
if (bo->flags & AMDGPU_BO_FLAGS_GBM) {
@@ -289,9 +289,8 @@ struct amdgpu_buffer *amdgpu_bo_open(amdgpu_device_handle pDev,
memset(&alloc_request, 0, sizeof(struct amdgpu_bo_alloc_request));
bo = (struct amdgpu_buffer *)calloc(1, sizeof(struct amdgpu_buffer));
- if (bo == NULL) {
+ if (!bo)
return NULL;
- }
alloc_request.alloc_size = alloc_size;
alloc_request.phys_alignment = phys_alignment;
@@ -376,9 +375,8 @@ struct amdgpu_buffer *amdgpu_gem_bo_open_prime(amdgpu_device_handle pDev,
struct amdgpu_bo_import_result buffer = {0};
bo = (struct amdgpu_buffer *)calloc(1, sizeof(struct amdgpu_buffer));
- if (bo == NULL) {
+ if (!bo)
return NULL;
- }
if (amdgpu_bo_import(pDev, amdgpu_bo_handle_type_dma_buf_fd,
(uint32_t)fd_handle, &buffer)) {
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 4a0f8bf..a9e2819 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -162,7 +162,7 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen,
}
buffers = calloc(1, sizeof *buffers);
- if (buffers == NULL)
+ if (!buffers)
goto error;
if (pixmap) {
@@ -176,7 +176,7 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen,
}
privates = calloc(1, sizeof(struct dri2_buffer_priv));
- if (privates == NULL)
+ if (!privates)
goto error;
buffers->attachment = attachment;
@@ -830,7 +830,7 @@ static int amdgpu_dri2_get_msc(DrawablePtr draw, CARD64 * ust, CARD64 * msc)
xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw, TRUE);
/* Drawable not displayed, make up a value */
- if (crtc == NULL) {
+ if (!crtc) {
*ust = 0;
*msc = 0;
return TRUE;
@@ -941,7 +941,7 @@ static int amdgpu_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 = amdgpu_get_msc_delta(draw, crtc);
@@ -1101,7 +1101,7 @@ static int amdgpu_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
amdgpu_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 = amdgpu_get_msc_delta(draw, crtc);
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 6efc372..44cdbcf 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -216,7 +216,7 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
int stride;
priv = calloc(1, sizeof(struct amdgpu_pixmap));
- if (priv == NULL)
+ if (!priv)
goto fallback_pixmap;
priv->bo = amdgpu_alloc_pixmap_bo(scrn, w, h, depth, usage,
diff --git a/src/amdgpu_glamor_wrappers.c b/src/amdgpu_glamor_wrappers.c
index fab8e5a..d44eec9 100644
--- a/src/amdgpu_glamor_wrappers.c
+++ b/src/amdgpu_glamor_wrappers.c
@@ -209,7 +209,7 @@ amdgpu_glamor_picture_prepare_access_cpu_ro(ScrnInfoPtr scrn,
PixmapPtr pixmap;
struct amdgpu_pixmap *priv;
- if (picture->pDrawable == NULL)
+ if (!picture->pDrawable)
return TRUE;
pixmap = get_drawable_pixmap(picture->pDrawable);
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 5ea90f9..bedd020 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1511,7 +1511,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- if (pScrn->modes == NULL
+ if (!pScrn->modes
#ifdef XSERVER_PLATFORM_BUS
&& !pScrn->is_gpu
#endif
@@ -1781,7 +1781,7 @@ Bool AMDGPUScreenInit_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;
@@ -2160,7 +2160,7 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
cursor_size = AMDGPU_ALIGN(cursor_size, AMDGPU_GPU_PAGE_SIZE);
for (c = 0; c < xf86_config->num_crtc; c++) {
/* cursor objects */
- if (info->cursor_buffer[c] == NULL) {
+ if (!info->cursor_buffer[c]) {
if (info->gbm) {
info->cursor_buffer[c] = (struct amdgpu_buffer *)calloc(1, sizeof(struct amdgpu_buffer));
if (!info->cursor_buffer[c]) {
@@ -2202,7 +2202,7 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
}
}
- if (info->front_buffer == NULL) {
+ if (!info->front_buffer) {
int pitch;
int hint = 0;
diff --git a/src/amdgpu_pixmap.c b/src/amdgpu_pixmap.c
index f2008b5..c5e80ad 100644
--- a/src/amdgpu_pixmap.c
+++ b/src/amdgpu_pixmap.c
@@ -56,7 +56,7 @@ amdgpu_pixmap_create(ScreenPtr screen, int w, int h, int depth, unsigned usage)
int stride;
priv = calloc(1, sizeof(struct amdgpu_pixmap));
- if (priv == NULL)
+ if (!priv)
goto fallback_pixmap;
scrn = xf86ScreenToScrn(screen);
diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index d744ca5..0cff195 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -62,7 +62,7 @@ static inline Bool amdgpu_set_pixmap_bo(PixmapPtr pPix, struct amdgpu_buffer *bo
struct amdgpu_pixmap *priv;
priv = amdgpu_get_pixmap_private(pPix);
- if (priv == NULL && bo == NULL)
+ if (!priv && !bo)
return TRUE;
if (priv) {
diff --git a/src/amdgpu_video.c b/src/amdgpu_video.c
index 8f9a2b9..94ae170 100644
--- a/src/amdgpu_video.c
+++ b/src/amdgpu_video.c
@@ -135,7 +135,7 @@ void AMDGPUInitVideo(ScreenPtr pScreen)
num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
newAdaptors =
malloc((num_adaptors + 2) * sizeof(*newAdaptors));
- if (newAdaptors == NULL)
+ if (!newAdaptors)
return;
memcpy(newAdaptors, adaptors,
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 49284c6..0ee8996 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -368,7 +368,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
return pixmap;
fbcon = drmModeGetFB(pAMDGPUEnt->fd, fbcon_id);
- if (fbcon == NULL)
+ if (!fbcon)
return NULL;
if (fbcon->depth != pScrn->depth ||
@@ -384,7 +384,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
}
bo = calloc(1, sizeof(struct amdgpu_buffer));
- if (bo == NULL) {
+ if (!bo) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate bo for fbcon handle\n");
goto out_free_fb;
@@ -1342,7 +1342,7 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
crtc = xf86CrtcCreate(pScrn, &info->drmmode_crtc_funcs);
- if (crtc == NULL)
+ if (!crtc)
return 0;
drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
@@ -2233,7 +2233,7 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
width, height, -1, -1, pitch, info->front_buffer->cpu_ptr);
} else {
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;