Skip to content

Commit

Permalink
Staging: ion: fix code style warning from NULL comparisons
Browse files Browse the repository at this point in the history
This patch replaces several instances where a pointer is compared to NULL
(i.e., `ptr == NULL`) with `!ptr`, which is preferred.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Quytelda Kahja authored and Greg Kroah-Hartman committed Jun 29, 2017
1 parent bd18c0c commit 878c33a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/android/ion/ion.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
goto err2;
}

if (buffer->sg_table == NULL) {
if (!buffer->sg_table) {
WARN_ONCE(1, "This heap needs to set the sgtable");
ret = -EINVAL;
goto err1;
Expand Down Expand Up @@ -161,7 +161,7 @@ static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
return buffer->vaddr;
}
vaddr = buffer->heap->ops->map_kernel(buffer->heap, buffer);
if (WARN_ONCE(vaddr == NULL,
if (WARN_ONCE(!vaddr,
"heap->ops->map_kernel should return ERR_PTR on error"))
return ERR_PTR(-EINVAL);
if (IS_ERR(vaddr))
Expand Down Expand Up @@ -425,7 +425,7 @@ int ion_alloc(size_t len, unsigned int heap_id_mask, unsigned int flags)
}
up_read(&dev->lock);

if (buffer == NULL)
if (!buffer)
return -ENODEV;

if (IS_ERR(buffer))
Expand Down

0 comments on commit 878c33a

Please sign in to comment.