958e60d
From e4d9fccaaf6e61bbc7416d92d73cec5a5f0cb458 Mon Sep 17 00:00:00 2001
958e60d
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
958e60d
Date: Thu, 9 May 2019 16:31:36 +0200
958e60d
Subject: [PATCH 4/4] staging: vchiq: stop explicitly comparing with zero to
958e60d
 catch errors
958e60d
958e60d
The vchiq code tends to follow a coding pattern that's not accepted as
958e60d
per the Linux kernel coding style
958e60d
958e60d
We have this:
958e60d
	if (expression != 0)
958e60d
958e60d
We want this:
958e60d
	if (expression)
958e60d
958e60d
We make an exception if the expression refers to a size, in which case
958e60d
it's accepted for the sake of clarity.
958e60d
958e60d
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
958e60d
---
958e60d
 .../bcm2835-camera/bcm2835-camera.c           | 11 ++--
958e60d
 .../interface/vchiq_arm/vchiq_2835_arm.c      |  2 +-
958e60d
 .../interface/vchiq_arm/vchiq_arm.c           | 66 ++++++++-----------
958e60d
 .../interface/vchiq_arm/vchiq_connected.c     |  4 +-
958e60d
 .../interface/vchiq_arm/vchiq_core.c          | 28 ++++----
958e60d
 .../interface/vchiq_arm/vchiq_debugfs.c       |  4 +-
958e60d
 6 files changed, 52 insertions(+), 63 deletions(-)
958e60d
958e60d
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
958e60d
index 7c6cf41645eb..c5b29a28d326 100644
958e60d
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
958e60d
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
958e60d
@@ -328,7 +328,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
958e60d
 		 "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n",
958e60d
 		 __func__, status, buf, length, mmal_flags, pts);
958e60d
 
958e60d
-	if (status != 0) {
958e60d
+	if (status) {
958e60d
 		/* error in transfer */
958e60d
 		if (buf) {
958e60d
 			/* there was a buffer with the error so return it */
958e60d
@@ -360,8 +360,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
958e60d
 		}
958e60d
 	} else {
958e60d
 		if (dev->capture.frame_count) {
958e60d
-			if (dev->capture.vc_start_timestamp != -1 &&
958e60d
-			    pts != 0) {
958e60d
+			if (dev->capture.vc_start_timestamp != -1 && pts) {
958e60d
 				ktime_t timestamp;
958e60d
 				s64 runtime_us = pts -
958e60d
 				    dev->capture.vc_start_timestamp;
958e60d
@@ -829,7 +828,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
958e60d
 			     struct v4l2_input *inp)
958e60d
 {
958e60d
 	/* only a single camera input */
958e60d
-	if (inp->index != 0)
958e60d
+	if (inp->index)
958e60d
 		return -EINVAL;
958e60d
 
958e60d
 	inp->type = V4L2_INPUT_TYPE_CAMERA;
958e60d
@@ -845,7 +844,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
958e60d
 
958e60d
 static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
958e60d
 {
958e60d
-	if (i != 0)
958e60d
+	if (i)
958e60d
 		return -EINVAL;
958e60d
 
958e60d
 	return 0;
958e60d
@@ -1291,7 +1290,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
958e60d
 	}
958e60d
 
958e60d
 	ret = mmal_setup_components(dev, f);
958e60d
-	if (ret != 0) {
958e60d
+	if (ret) {
958e60d
 		v4l2_err(&dev->v4l2_dev,
958e60d
 			 "%s: failed to setup mmal components: %d\n",
958e60d
 			 __func__, ret);
958e60d
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
958e60d
index 833b28e9ba4b..e87d6e290a9f 100644
958e60d
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
958e60d
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
958e60d
@@ -553,7 +553,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
958e60d
 		(g_cache_line_size - 1)))) {
958e60d
 		char *fragments;
958e60d
 
958e60d
-		if (down_interruptible(&g_free_fragments_sema) != 0) {
958e60d
+		if (down_interruptible(&g_free_fragments_sema)) {
958e60d
 			cleanup_pagelistinfo(pagelistinfo);
958e60d
 			return NULL;
958e60d
 		}
958e60d
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
958e60d
index ccfb8218b83c..934014cf08b2 100644
958e60d
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
958e60d
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
958e60d
@@ -266,7 +266,7 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance)
958e60d
 	vchiq_log_trace(vchiq_core_log_level,
958e60d
 		"%s(%p) called", __func__, instance);
958e60d
 
958e60d
-	if (mutex_lock_killable(&state->mutex) != 0)
958e60d
+	if (mutex_lock_killable(&state->mutex))
958e60d
 		return VCHIQ_RETRY;
958e60d
 
958e60d
 	/* Remove all services */
958e60d
@@ -308,7 +308,7 @@ VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance)
958e60d
 	vchiq_log_trace(vchiq_core_log_level,
958e60d
 		"%s(%p) called", __func__, instance);
958e60d
 
958e60d
-	if (mutex_lock_killable(&state->mutex) != 0) {
958e60d
+	if (mutex_lock_killable(&state->mutex)) {
958e60d
 		vchiq_log_trace(vchiq_core_log_level,
958e60d
 			"%s: call to mutex_lock failed", __func__);
958e60d
 		status = VCHIQ_RETRY;
958e60d
@@ -673,8 +673,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header,
958e60d
 
958e60d
 			DEBUG_TRACE(SERVICE_CALLBACK_LINE);
958e60d
 			if (wait_for_completion_interruptible(
958e60d
-						&user_service->remove_event)
958e60d
-				!= 0) {
958e60d
+						&user_service->remove_event)) {
958e60d
 				vchiq_log_info(vchiq_arm_log_level,
958e60d
 					"%s interrupted", __func__);
958e60d
 				DEBUG_TRACE(SERVICE_CALLBACK_LINE);
958e60d
@@ -878,7 +877,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 			break;
958e60d
 		}
958e60d
 		rc = mutex_lock_killable(&instance->state->mutex);
958e60d
-		if (rc != 0) {
958e60d
+		if (rc) {
958e60d
 			vchiq_log_error(vchiq_arm_log_level,
958e60d
 				"vchiq: connect: could not lock mutex for "
958e60d
 				"state %d: %d",
958e60d
@@ -902,9 +901,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 		void *userdata;
958e60d
 		int srvstate;
958e60d
 
958e60d
-		if (copy_from_user
958e60d
-			 (&args, (const void __user *)arg,
958e60d
-			  sizeof(args)) != 0) {
958e60d
+		if (copy_from_user(&args, (const void __user *)arg,
958e60d
+				   sizeof(args))) {
958e60d
 			ret = -EFAULT;
958e60d
 			break;
958e60d
 		}
958e60d
@@ -968,7 +966,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 				&(((struct vchiq_create_service __user *)
958e60d
 					arg)->handle),
958e60d
 				(const void *)&service->handle,
958e60d
-				sizeof(service->handle)) != 0) {
958e60d
+				sizeof(service->handle))) {
958e60d
 				ret = -EFAULT;
958e60d
 				vchiq_remove_service(service->handle);
958e60d
 			}
958e60d
@@ -1043,9 +1041,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 	case VCHIQ_IOC_QUEUE_MESSAGE: {
958e60d
 		struct vchiq_queue_message args;
958e60d
 
958e60d
-		if (copy_from_user
958e60d
-			 (&args, (const void __user *)arg,
958e60d
-			  sizeof(args)) != 0) {
958e60d
+		if (copy_from_user(&args, (const void __user *)arg,
958e60d
+				   sizeof(args))) {
958e60d
 			ret = -EFAULT;
958e60d
 			break;
958e60d
 		}
958e60d
@@ -1077,9 +1074,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 			(cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ?
958e60d
 			VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE;
958e60d
 
958e60d
-		if (copy_from_user
958e60d
-			(&args, (const void __user *)arg,
958e60d
-			sizeof(args)) != 0) {
958e60d
+		if (copy_from_user(&args, (const void __user *)arg,
958e60d
+				   sizeof(args))) {
958e60d
 			ret = -EFAULT;
958e60d
 			break;
958e60d
 		}
958e60d
@@ -1153,7 +1149,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 				&(((struct vchiq_queue_bulk_transfer __user *)
958e60d
 					arg)->mode),
958e60d
 				(const void *)&mode_waiting,
958e60d
-				sizeof(mode_waiting)) != 0)
958e60d
+				sizeof(mode_waiting)))
958e60d
 				ret = -EFAULT;
958e60d
 		}
958e60d
 	} break;
958e60d
@@ -1168,7 +1164,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 		}
958e60d
 
958e60d
 		if (copy_from_user(&args, (const void __user *)arg,
958e60d
-			sizeof(args)) != 0) {
958e60d
+			sizeof(args))) {
958e60d
 			ret = -EFAULT;
958e60d
 			break;
958e60d
 		}
958e60d
@@ -1186,7 +1182,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 			rc = wait_for_completion_interruptible(
958e60d
 						&instance->insert_event);
958e60d
 			mutex_lock(&instance->completion_mutex);
958e60d
-			if (rc != 0) {
958e60d
+			if (rc) {
958e60d
 				DEBUG_TRACE(AWAIT_COMPLETION_LINE);
958e60d
 				vchiq_log_info(vchiq_arm_log_level,
958e60d
 					"AWAIT_COMPLETION interrupted");
958e60d
@@ -1252,7 +1248,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 					if (copy_from_user(&msgbuf,
958e60d
 						(const void __user *)
958e60d
 						&args.msgbufs[msgbufcount],
958e60d
-						sizeof(msgbuf)) != 0) {
958e60d
+						sizeof(msgbuf))) {
958e60d
 						if (ret == 0)
958e60d
 							ret = -EFAULT;
958e60d
 						break;
958e60d
@@ -1260,7 +1256,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 
958e60d
 					/* Copy the message to user space */
958e60d
 					if (copy_to_user(msgbuf, header,
958e60d
-						msglen) != 0) {
958e60d
+						msglen)) {
958e60d
 						if (ret == 0)
958e60d
 							ret = -EFAULT;
958e60d
 						break;
958e60d
@@ -1285,8 +1281,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 					(size_t)args.buf + ret *
958e60d
 					sizeof(struct vchiq_completion_data)),
958e60d
 					completion,
958e60d
-					sizeof(struct vchiq_completion_data))
958e60d
-									!= 0) {
958e60d
+					sizeof(struct vchiq_completion_data))) {
958e60d
 						if (ret == 0)
958e60d
 							ret = -EFAULT;
958e60d
 					break;
958e60d
@@ -1306,13 +1301,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 					&((struct vchiq_await_completion *)arg)
958e60d
 						->msgbufcount,
958e60d
 					&msgbufcount,
958e60d
-					sizeof(msgbufcount)) != 0) {
958e60d
+					sizeof(msgbufcount))) {
958e60d
 					ret = -EFAULT;
958e60d
 				}
958e60d
 			}
958e60d
 		}
958e60d
 
958e60d
-		if (ret != 0)
958e60d
+		if (ret)
958e60d
 			complete(&instance->remove_event);
958e60d
 		mutex_unlock(&instance->completion_mutex);
958e60d
 		DEBUG_TRACE(AWAIT_COMPLETION_LINE);
958e60d
@@ -1324,9 +1319,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 		struct vchiq_header *header;
958e60d
 
958e60d
 		DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
958e60d
-		if (copy_from_user
958e60d
-			 (&args, (const void __user *)arg,
958e60d
-			  sizeof(args)) != 0) {
958e60d
+		if (copy_from_user(&args, (const void __user *)arg,
958e60d
+				   sizeof(args))) {
958e60d
 			ret = -EFAULT;
958e60d
 			break;
958e60d
 		}
958e60d
@@ -1412,7 +1406,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 		struct vchiq_config config;
958e60d
 
958e60d
 		if (copy_from_user(&args, (const void __user *)arg,
958e60d
-			sizeof(args)) != 0) {
958e60d
+				   sizeof(args))) {
958e60d
 			ret = -EFAULT;
958e60d
 			break;
958e60d
 		}
958e60d
@@ -1431,9 +1425,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
958e60d
 	case VCHIQ_IOC_SET_SERVICE_OPTION: {
958e60d
 		struct vchiq_set_service_option args;
958e60d
 
958e60d
-		if (copy_from_user(
958e60d
-			&args, (const void __user *)arg,
958e60d
-			sizeof(args)) != 0) {
958e60d
+		if (copy_from_user(&args, (const void __user *)arg,
958e60d
+				   sizeof(args))) {
958e60d
 			ret = -EFAULT;
958e60d
 			break;
958e60d
 		}
958e60d
@@ -2361,8 +2354,7 @@ vchiq_keepalive_thread_func(void *v)
958e60d
 	while (1) {
958e60d
 		long rc = 0, uc = 0;
958e60d
 
958e60d
-		if (wait_for_completion_interruptible(&arm_state->ka_evt)
958e60d
-				!= 0) {
958e60d
+		if (wait_for_completion_interruptible(&arm_state->ka_evt)) {
958e60d
 			vchiq_log_error(vchiq_susp_log_level,
958e60d
 				"%s interrupted", __func__);
958e60d
 			flush_signals(current);
958e60d
@@ -3043,7 +3035,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
958e60d
 			vchiq_log_info(vchiq_susp_log_level, "%s %s resume "
958e60d
 				"blocked - waiting...", __func__, entity);
958e60d
 			if (wait_for_completion_killable(
958e60d
-					&arm_state->resume_blocker) != 0) {
958e60d
+					&arm_state->resume_blocker)) {
958e60d
 				vchiq_log_error(vchiq_susp_log_level, "%s %s "
958e60d
 					"wait for resume blocker interrupted",
958e60d
 					__func__, entity);
958e60d
@@ -3092,7 +3084,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
958e60d
 		vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume",
958e60d
 			__func__, entity);
958e60d
 		if (wait_for_completion_killable(
958e60d
-				&arm_state->vc_resume_complete) != 0) {
958e60d
+				&arm_state->vc_resume_complete)) {
958e60d
 			vchiq_log_error(vchiq_susp_log_level, "%s %s wait for "
958e60d
 				"resume interrupted", __func__, entity);
958e60d
 			ret = VCHIQ_ERROR;
958e60d
@@ -3537,13 +3529,13 @@ static int vchiq_probe(struct platform_device *pdev)
958e60d
 	platform_set_drvdata(pdev, drvdata);
958e60d
 
958e60d
 	err = vchiq_platform_init(pdev, &g_state);
958e60d
-	if (err != 0)
958e60d
+	if (err)
958e60d
 		goto failed_platform_init;
958e60d
 
958e60d
 	cdev_init(&vchiq_cdev, &vchiq_fops);
958e60d
 	vchiq_cdev.owner = THIS_MODULE;
958e60d
 	err = cdev_add(&vchiq_cdev, vchiq_devid, 1);
958e60d
-	if (err != 0) {
958e60d
+	if (err) {
958e60d
 		vchiq_log_error(vchiq_arm_log_level,
958e60d
 			"Unable to register device");
958e60d
 		goto failed_platform_init;
958e60d
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
958e60d
index 7d64e2ed7b42..5bcb6396b23b 100644
958e60d
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
958e60d
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
958e60d
@@ -71,7 +71,7 @@ void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback)
958e60d
 {
958e60d
 	connected_init();
958e60d
 
958e60d
-	if (mutex_lock_killable(&g_connected_mutex) != 0)
958e60d
+	if (mutex_lock_killable(&g_connected_mutex))
958e60d
 		return;
958e60d
 
958e60d
 	if (g_connected)
958e60d
@@ -106,7 +106,7 @@ void vchiq_call_connected_callbacks(void)
958e60d
 
958e60d
 	connected_init();
958e60d
 
958e60d
-	if (mutex_lock_killable(&g_connected_mutex) != 0)
958e60d
+	if (mutex_lock_killable(&g_connected_mutex))
958e60d
 		return;
958e60d
 
958e60d
 	for (i = 0; i <  g_num_deferred_callbacks; i++)
958e60d
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
958e60d
index 0958d86aebe6..bbdf16977afb 100644
958e60d
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
958e60d
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
958e60d
@@ -830,7 +830,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
958e60d
 	WARN_ON(!(stride <= VCHIQ_SLOT_SIZE));
958e60d
 
958e60d
 	if (!(flags & QMFLAGS_NO_MUTEX_LOCK) &&
958e60d
-		(mutex_lock_killable(&state->slot_mutex) != 0))
958e60d
+	    mutex_lock_killable(&state->slot_mutex))
958e60d
 		return VCHIQ_RETRY;
958e60d
 
958e60d
 	if (type == VCHIQ_MSG_DATA) {
958e60d
@@ -842,8 +842,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
958e60d
 			return VCHIQ_ERROR;
958e60d
 		}
958e60d
 
958e60d
-		WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK |
958e60d
-				  QMFLAGS_NO_MUTEX_UNLOCK)) != 0);
958e60d
+		WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
958e60d
+				 QMFLAGS_NO_MUTEX_UNLOCK));
958e60d
 
958e60d
 		if (service->closing) {
958e60d
 			/* The service has been closed */
958e60d
@@ -904,7 +904,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
958e60d
 				return VCHIQ_RETRY;
958e60d
 			if (service->closing)
958e60d
 				return VCHIQ_ERROR;
958e60d
-			if (mutex_lock_killable(&state->slot_mutex) != 0)
958e60d
+			if (mutex_lock_killable(&state->slot_mutex))
958e60d
 				return VCHIQ_RETRY;
958e60d
 			if (service->srvstate != VCHIQ_SRVSTATE_OPEN) {
958e60d
 				/* The service has been closed */
958e60d
@@ -942,8 +942,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
958e60d
 			header, size, VCHIQ_MSG_SRCPORT(msgid),
958e60d
 			VCHIQ_MSG_DSTPORT(msgid));
958e60d
 
958e60d
-		WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK |
958e60d
-				  QMFLAGS_NO_MUTEX_UNLOCK)) != 0);
958e60d
+		WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
958e60d
+				 QMFLAGS_NO_MUTEX_UNLOCK));
958e60d
 
958e60d
 		callback_result =
958e60d
 			copy_message_data(copy_callback, context,
958e60d
@@ -1070,8 +1070,8 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
958e60d
 
958e60d
 	local = state->local;
958e60d
 
958e60d
-	if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) &&
958e60d
-		(mutex_lock_killable(&state->sync_mutex) != 0))
958e60d
+	if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME &&
958e60d
+	    mutex_lock_killable(&state->sync_mutex))
958e60d
 		return VCHIQ_RETRY;
958e60d
 
958e60d
 	remote_event_wait(&state->sync_release_event, &local->sync_release);
958e60d
@@ -1748,8 +1748,7 @@ parse_rx_slots(struct vchiq_state *state)
958e60d
 					&service->bulk_rx : &service->bulk_tx;
958e60d
 
958e60d
 				DEBUG_TRACE(PARSE_LINE);
958e60d
-				if (mutex_lock_killable(
958e60d
-					&service->bulk_mutex) != 0) {
958e60d
+				if (mutex_lock_killable(&service->bulk_mutex)) {
958e60d
 					DEBUG_TRACE(PARSE_LINE);
958e60d
 					goto bail_not_ready;
958e60d
 				}
958e60d
@@ -2553,7 +2552,7 @@ do_abort_bulks(struct vchiq_service *service)
958e60d
 	VCHIQ_STATUS_T status;
958e60d
 
958e60d
 	/* Abort any outstanding bulk transfers */
958e60d
-	if (mutex_lock_killable(&service->bulk_mutex) != 0)
958e60d
+	if (mutex_lock_killable(&service->bulk_mutex))
958e60d
 		return 0;
958e60d
 	abort_outstanding_bulks(service, &service->bulk_tx);
958e60d
 	abort_outstanding_bulks(service, &service->bulk_rx);
958e60d
@@ -3068,7 +3067,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
958e60d
 	queue = (dir == VCHIQ_BULK_TRANSMIT) ?
958e60d
 		&service->bulk_tx : &service->bulk_rx;
958e60d
 
958e60d
-	if (mutex_lock_killable(&service->bulk_mutex) != 0) {
958e60d
+	if (mutex_lock_killable(&service->bulk_mutex)) {
958e60d
 		status = VCHIQ_RETRY;
958e60d
 		goto error_exit;
958e60d
 	}
958e60d
@@ -3082,8 +3081,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
958e60d
 				status = VCHIQ_RETRY;
958e60d
 				goto error_exit;
958e60d
 			}
958e60d
-			if (mutex_lock_killable(&service->bulk_mutex)
958e60d
-				!= 0) {
958e60d
+			if (mutex_lock_killable(&service->bulk_mutex)) {
958e60d
 				status = VCHIQ_RETRY;
958e60d
 				goto error_exit;
958e60d
 			}
958e60d
@@ -3111,7 +3109,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
958e60d
 
958e60d
 	/* The slot mutex must be held when the service is being closed, so
958e60d
 	   claim it here to ensure that isn't happening */
958e60d
-	if (mutex_lock_killable(&state->slot_mutex) != 0) {
958e60d
+	if (mutex_lock_killable(&state->slot_mutex)) {
958e60d
 		status = VCHIQ_RETRY;
958e60d
 		goto cancel_bulk_error_exit;
958e60d
 	}
958e60d
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
958e60d
index 3928287cf5f7..8799c30f397c 100644
958e60d
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
958e60d
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
958e60d
@@ -114,7 +114,7 @@ static ssize_t debugfs_log_write(struct file *file,
958e60d
 	if (count >= DEBUGFS_WRITE_BUF_SIZE)
958e60d
 		count = DEBUGFS_WRITE_BUF_SIZE;
958e60d
 
958e60d
-	if (copy_from_user(kbuf, buffer, count) != 0)
958e60d
+	if (copy_from_user(kbuf, buffer, count))
958e60d
 		return -EFAULT;
958e60d
 	kbuf[count - 1] = 0;
958e60d
 
958e60d
@@ -179,7 +179,7 @@ static ssize_t debugfs_trace_write(struct file *file,
958e60d
 	VCHIQ_INSTANCE_T instance = f->private;
958e60d
 	char firstchar;
958e60d
 
958e60d
-	if (copy_from_user(&firstchar, buffer, 1) != 0)
958e60d
+	if (copy_from_user(&firstchar, buffer, 1))
958e60d
 		return -EFAULT;
958e60d
 
958e60d
 	switch (firstchar) {
958e60d
-- 
958e60d
2.21.0
958e60d