[PATCH 6/7] staging: most: cdev.c: use ! operator instead of NULL comparison

Chaehyun Lim chaehyun.lim at gmail.com
Thu Aug 6 01:20:16 UTC 2015


Use ! operator instead of NULL comparison found by checkpatch.pl.

Signed-off-by: Chaehyun Lim <chaehyun.lim at gmail.com>
---
 drivers/staging/most/aim-cdev/cdev.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index 03adb8c..c8b91cd 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -172,7 +172,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
 			return -EAGAIN;
 		mbo = most_get_mbo(channel->iface, channel->channel_id);
 		if (wait_event_interruptible(
-			    channel->wq, mbo || (channel->dev == NULL)))
+			    channel->wq, mbo || (!channel->dev)))
 			return -ERESTARTSYS;
 	}
 
@@ -227,13 +227,12 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
 		channel->keep_mbo = false;
 		goto start_copy;
 	}
-	while ((0 == kfifo_out(&channel->fifo, &mbo, 1)) &&
-	       (channel->dev != NULL)) {
+	while ((0 == kfifo_out(&channel->fifo, &mbo, 1)) && channel->dev) {
 		if (filp->f_flags & O_NONBLOCK)
 			return -EAGAIN;
 		if (wait_event_interruptible(channel->wq,
 					     (!kfifo_is_empty(&channel->fifo) ||
-					      (channel->dev == NULL))))
+					      (!channel->dev))))
 			return -ERESTARTSYS;
 	}
 
@@ -298,7 +297,7 @@ int aim_disconnect_channel(struct most_interface *iface, int channel_id)
 	}
 
 	channel = get_channel(iface, channel_id);
-	if (channel == NULL)
+	if (!channel)
 		return -ENXIO;
 
 	mutex_lock(&channel->io_mutex);
@@ -335,7 +334,7 @@ int aim_rx_completion(struct mbo *mbo)
 		return -EINVAL;
 
 	channel = get_channel(mbo->ifp, mbo->hdm_channel_id);
-	if (channel == NULL)
+	if (!channel)
 		return -ENXIO;
 
 	kfifo_in(&channel->fifo, &mbo, 1);
@@ -368,7 +367,7 @@ int aim_tx_completion(struct most_interface *iface, int channel_id)
 	}
 
 	channel = get_channel(iface, channel_id);
-	if (channel == NULL)
+	if (!channel)
 		return -ENXIO;
 	wake_up_interruptible(&channel->wq);
 	return 0;
-- 
1.9.1



More information about the devel mailing list