Commit 4bc58d16 authored by Aishwarya Pant's avatar Aishwarya Pant Committed by Greg Kroah-Hartman

staging: vc04_services: bcm2835-camera: Simplify NULL comparisons

Remove instances of explicit NULL comparisons in bcm2835-camera driver
for code compaction.
Signed-off-by: default avatarAishwarya Pant <aishpant@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 69385ad9
......@@ -250,7 +250,7 @@ static int queue_setup(struct vb2_queue *vq,
unsigned long size;
/* refuse queue setup if port is not configured */
if (dev->capture.port == NULL) {
if (!dev->capture.port) {
v4l2_err(&dev->v4l2_dev,
"%s: capture port not configured\n", __func__);
return -EINVAL;
......@@ -289,8 +289,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n",
__func__, dev);
BUG_ON(dev->capture.port == NULL);
BUG_ON(dev->capture.fmt == NULL);
BUG_ON(!dev->capture.port);
BUG_ON(!dev->capture.fmt);
size = dev->capture.stride * dev->capture.height;
if (vb2_plane_size(vb, 0) < size) {
......@@ -324,14 +324,14 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
if (status != 0) {
/* error in transfer */
if (buf != NULL) {
if (buf) {
/* there was a buffer with the error so return it */
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
}
return;
} else if (length == 0) {
/* stream ended */
if (buf != NULL) {
if (buf) {
/* this should only ever happen if the port is
* disabled and there are buffers still queued
*/
......@@ -513,7 +513,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
__func__, dev);
/* ensure a format has actually been set */
if (dev->capture.port == NULL)
if (!dev->capture.port)
return -EINVAL;
if (enable_camera(dev) < 0) {
......@@ -604,7 +604,7 @@ static void stop_streaming(struct vb2_queue *vq)
dev->capture.frame_count = 0;
/* ensure a format has actually been set */
if (dev->capture.port == NULL) {
if (!dev->capture.port) {
v4l2_err(&dev->v4l2_dev,
"no capture port - stream not started?\n");
return;
......
......@@ -125,7 +125,7 @@ int set_framerate_params(struct bm2835_mmal_dev *dev);
{ \
v4l2_dbg(level, debug, dev, \
"%s: w %u h %u field %u pfmt 0x%x bpl %u sz_img %u colorspace 0x%x priv %u\n", \
desc == NULL ? "" : desc, \
!desc ? "" : desc, \
(pix_fmt)->width, (pix_fmt)->height, (pix_fmt)->field, \
(pix_fmt)->pixelformat, (pix_fmt)->bytesperline, \
(pix_fmt)->sizeimage, (pix_fmt)->colorspace, (pix_fmt)->priv); \
......@@ -135,7 +135,7 @@ int set_framerate_params(struct bm2835_mmal_dev *dev);
v4l2_dbg(level, debug, dev, \
"%s: w %u h %u l %u t %u field %u chromakey %06X clip %p " \
"clipcount %u bitmap %p\n", \
desc == NULL ? "" : desc, \
!desc ? "" : desc, \
(win_fmt)->w.width, (win_fmt)->w.height, \
(win_fmt)->w.left, (win_fmt)->w.top, \
(win_fmt)->field, \
......
......@@ -909,9 +909,7 @@ static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl)
const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl = ctrl->priv;
int ret;
if ((mmal_ctrl == NULL) ||
(mmal_ctrl->id != ctrl->id) ||
(mmal_ctrl->setter == NULL)) {
if (!mmal_ctrl || mmal_ctrl->id != ctrl->id || !mmal_ctrl->setter) {
pr_warn("mmal_ctrl:%p ctrl id:%d\n", mmal_ctrl, ctrl->id);
return -EINVAL;
}
......
......@@ -657,7 +657,7 @@ static void service_callback(void *param,
* should be verified the address lies in the kernel
* address space.
*/
if (msg->h.context == NULL) {
if (!msg->h.context) {
pr_err("received message context was null!\n");
vchi_held_msg_release(&msg_handle);
break;
......@@ -1387,7 +1387,7 @@ static int port_enable(struct vchiq_mmal_instance *instance,
return 0;
/* ensure there are enough buffers queued to cover the buffer headers */
if (port->buffer_cb != NULL) {
if (port->buffer_cb) {
hdr_count = 0;
list_for_each(buf_head, &port->buffers) {
hdr_count++;
......@@ -1547,7 +1547,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
return -EINTR;
/* disconnect ports if connected */
if (src->connected != NULL) {
if (src->connected) {
ret = port_disable(instance, src);
if (ret) {
pr_err("failed disabling src port(%d)\n", ret);
......@@ -1570,7 +1570,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
src->connected = NULL;
}
if (dst == NULL) {
if (!dst) {
/* do not make new connection */
ret = 0;
pr_debug("not making new connection\n");
......@@ -1817,7 +1817,7 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance)
{
int status = 0;
if (instance == NULL)
if (!instance)
return -EINVAL;
if (mutex_lock_interruptible(&instance->vchiq_mutex))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment