From: Aishwarya Pant <aishpant@gmail.com>
To: Stephen Warren <swarren@wwwdotorg.org>,
Lee Jones <lee@kernel.org>, Eric Anholt <eric@anholt.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
bcm-kernel-feedback-list@broadcom.com
Cc: outreachy-kernel@googlegroups.com
Subject: [PATCH v2] staging: vc04_services: bcm2835-camera: Simplify NULL comparisons
Date: Wed, 1 Mar 2017 10:17:35 +0530 [thread overview]
Message-ID: <20170301044735.GA13746@aishwarya> (raw)
Remove instances of explicit NULL comparisons in bcm2835-camera driver
for code compaction.
Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
Changes in v2:
- Break up the changes
.../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index c4dad30..1baeef4 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -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;
--
2.7.4
next reply other threads:[~2017-03-01 4:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-01 4:47 Aishwarya Pant [this message]
2017-03-01 8:10 ` [PATCH v2] staging: vc04_services: bcm2835-camera: Simplify NULL comparisons Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170301044735.GA13746@aishwarya \
--to=aishpant@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=eric@anholt.net \
--cc=f.fainelli@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=lee@kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=swarren@wwwdotorg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.