Commit 023dbe17 authored by Nicolas Saenz Julienne's avatar Nicolas Saenz Julienne Committed by Greg Kroah-Hartman

staging: vchiq: stop explicitly comparing with zero to catch errors

The vchiq code tends to follow a coding pattern that's not accepted as
per the Linux kernel coding style

We have this:
	if (expression != 0)

We want this:
	if (expression)

We make an exception if the expression refers to a size, in which case
it's accepted for the sake of clarity.
Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 77cf3f5d
...@@ -327,7 +327,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, ...@@ -327,7 +327,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
"%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n", "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n",
__func__, status, buf, length, mmal_flags, pts); __func__, status, buf, length, mmal_flags, pts);
if (status != 0) { if (status) {
/* error in transfer */ /* error in transfer */
if (buf) { if (buf) {
/* there was a buffer with the error so return it */ /* there was a buffer with the error so return it */
...@@ -359,8 +359,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, ...@@ -359,8 +359,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
} }
} else { } else {
if (dev->capture.frame_count) { if (dev->capture.frame_count) {
if (dev->capture.vc_start_timestamp != -1 && if (dev->capture.vc_start_timestamp != -1 && pts) {
pts != 0) {
ktime_t timestamp; ktime_t timestamp;
s64 runtime_us = pts - s64 runtime_us = pts -
dev->capture.vc_start_timestamp; dev->capture.vc_start_timestamp;
...@@ -826,7 +825,7 @@ static int vidioc_enum_input(struct file *file, void *priv, ...@@ -826,7 +825,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *inp) struct v4l2_input *inp)
{ {
/* only a single camera input */ /* only a single camera input */
if (inp->index != 0) if (inp->index)
return -EINVAL; return -EINVAL;
inp->type = V4L2_INPUT_TYPE_CAMERA; inp->type = V4L2_INPUT_TYPE_CAMERA;
...@@ -842,7 +841,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) ...@@ -842,7 +841,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
static int vidioc_s_input(struct file *file, void *priv, unsigned int i) static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{ {
if (i != 0) if (i)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -1281,7 +1280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -1281,7 +1280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
} }
ret = mmal_setup_components(dev, f); ret = mmal_setup_components(dev, f);
if (ret != 0) { if (ret) {
v4l2_err(&dev->v4l2_dev, v4l2_err(&dev->v4l2_dev,
"%s: failed to setup mmal components: %d\n", "%s: failed to setup mmal components: %d\n",
__func__, ret); __func__, ret);
......
...@@ -514,7 +514,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type) ...@@ -514,7 +514,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
(g_cache_line_size - 1)))) { (g_cache_line_size - 1)))) {
char *fragments; char *fragments;
if (down_interruptible(&g_free_fragments_sema) != 0) { if (down_interruptible(&g_free_fragments_sema)) {
cleanup_pagelistinfo(pagelistinfo); cleanup_pagelistinfo(pagelistinfo);
return NULL; return NULL;
} }
......
...@@ -238,7 +238,7 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance) ...@@ -238,7 +238,7 @@ VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance)
vchiq_log_trace(vchiq_core_log_level, vchiq_log_trace(vchiq_core_log_level,
"%s(%p) called", __func__, instance); "%s(%p) called", __func__, instance);
if (mutex_lock_killable(&state->mutex) != 0) if (mutex_lock_killable(&state->mutex))
return VCHIQ_RETRY; return VCHIQ_RETRY;
/* Remove all services */ /* Remove all services */
...@@ -280,7 +280,7 @@ VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance) ...@@ -280,7 +280,7 @@ VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance)
vchiq_log_trace(vchiq_core_log_level, vchiq_log_trace(vchiq_core_log_level,
"%s(%p) called", __func__, instance); "%s(%p) called", __func__, instance);
if (mutex_lock_killable(&state->mutex) != 0) { if (mutex_lock_killable(&state->mutex)) {
vchiq_log_trace(vchiq_core_log_level, vchiq_log_trace(vchiq_core_log_level,
"%s: call to mutex_lock failed", __func__); "%s: call to mutex_lock failed", __func__);
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
...@@ -645,8 +645,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header, ...@@ -645,8 +645,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header,
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
if (wait_for_completion_interruptible( if (wait_for_completion_interruptible(
&user_service->remove_event) &user_service->remove_event)) {
!= 0) {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_info(vchiq_arm_log_level,
"%s interrupted", __func__); "%s interrupted", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
...@@ -850,7 +849,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -850,7 +849,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
break; break;
} }
rc = mutex_lock_killable(&instance->state->mutex); rc = mutex_lock_killable(&instance->state->mutex);
if (rc != 0) { if (rc) {
vchiq_log_error(vchiq_arm_log_level, vchiq_log_error(vchiq_arm_log_level,
"vchiq: connect: could not lock mutex for " "vchiq: connect: could not lock mutex for "
"state %d: %d", "state %d: %d",
...@@ -874,9 +873,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -874,9 +873,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
void *userdata; void *userdata;
int srvstate; int srvstate;
if (copy_from_user if (copy_from_user(&args, (const void __user *)arg,
(&args, (const void __user *)arg, sizeof(args))) {
sizeof(args)) != 0) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -940,7 +938,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -940,7 +938,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
&(((struct vchiq_create_service __user *) &(((struct vchiq_create_service __user *)
arg)->handle), arg)->handle),
(const void *)&service->handle, (const void *)&service->handle,
sizeof(service->handle)) != 0) { sizeof(service->handle))) {
ret = -EFAULT; ret = -EFAULT;
vchiq_remove_service(service->handle); vchiq_remove_service(service->handle);
} }
...@@ -1015,9 +1013,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1015,9 +1013,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case VCHIQ_IOC_QUEUE_MESSAGE: { case VCHIQ_IOC_QUEUE_MESSAGE: {
struct vchiq_queue_message args; struct vchiq_queue_message args;
if (copy_from_user if (copy_from_user(&args, (const void __user *)arg,
(&args, (const void __user *)arg, sizeof(args))) {
sizeof(args)) != 0) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -1049,9 +1046,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1049,9 +1046,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
(cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ? (cmd == VCHIQ_IOC_QUEUE_BULK_TRANSMIT) ?
VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE; VCHIQ_BULK_TRANSMIT : VCHIQ_BULK_RECEIVE;
if (copy_from_user if (copy_from_user(&args, (const void __user *)arg,
(&args, (const void __user *)arg, sizeof(args))) {
sizeof(args)) != 0) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -1125,7 +1121,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1125,7 +1121,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
&(((struct vchiq_queue_bulk_transfer __user *) &(((struct vchiq_queue_bulk_transfer __user *)
arg)->mode), arg)->mode),
(const void *)&mode_waiting, (const void *)&mode_waiting,
sizeof(mode_waiting)) != 0) sizeof(mode_waiting)))
ret = -EFAULT; ret = -EFAULT;
} }
} break; } break;
...@@ -1140,7 +1136,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1140,7 +1136,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
if (copy_from_user(&args, (const void __user *)arg, if (copy_from_user(&args, (const void __user *)arg,
sizeof(args)) != 0) { sizeof(args))) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -1158,7 +1154,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1158,7 +1154,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
rc = wait_for_completion_interruptible( rc = wait_for_completion_interruptible(
&instance->insert_event); &instance->insert_event);
mutex_lock(&instance->completion_mutex); mutex_lock(&instance->completion_mutex);
if (rc != 0) { if (rc) {
DEBUG_TRACE(AWAIT_COMPLETION_LINE); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
vchiq_log_info(vchiq_arm_log_level, vchiq_log_info(vchiq_arm_log_level,
"AWAIT_COMPLETION interrupted"); "AWAIT_COMPLETION interrupted");
...@@ -1224,7 +1220,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1224,7 +1220,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (copy_from_user(&msgbuf, if (copy_from_user(&msgbuf,
(const void __user *) (const void __user *)
&args.msgbufs[msgbufcount], &args.msgbufs[msgbufcount],
sizeof(msgbuf)) != 0) { sizeof(msgbuf))) {
if (ret == 0) if (ret == 0)
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -1232,7 +1228,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1232,7 +1228,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* Copy the message to user space */ /* Copy the message to user space */
if (copy_to_user(msgbuf, header, if (copy_to_user(msgbuf, header,
msglen) != 0) { msglen)) {
if (ret == 0) if (ret == 0)
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -1257,8 +1253,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1257,8 +1253,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
(size_t)args.buf + ret * (size_t)args.buf + ret *
sizeof(struct vchiq_completion_data)), sizeof(struct vchiq_completion_data)),
completion, completion,
sizeof(struct vchiq_completion_data)) sizeof(struct vchiq_completion_data))) {
!= 0) {
if (ret == 0) if (ret == 0)
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -1278,13 +1273,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1278,13 +1273,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
&((struct vchiq_await_completion *)arg) &((struct vchiq_await_completion *)arg)
->msgbufcount, ->msgbufcount,
&msgbufcount, &msgbufcount,
sizeof(msgbufcount)) != 0) { sizeof(msgbufcount))) {
ret = -EFAULT; ret = -EFAULT;
} }
} }
} }
if (ret != 0) if (ret)
complete(&instance->remove_event); complete(&instance->remove_event);
mutex_unlock(&instance->completion_mutex); mutex_unlock(&instance->completion_mutex);
DEBUG_TRACE(AWAIT_COMPLETION_LINE); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
...@@ -1296,9 +1291,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1296,9 +1291,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct vchiq_header *header; struct vchiq_header *header;
DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
if (copy_from_user if (copy_from_user(&args, (const void __user *)arg,
(&args, (const void __user *)arg, sizeof(args))) {
sizeof(args)) != 0) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -1384,7 +1378,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1384,7 +1378,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct vchiq_config config; struct vchiq_config config;
if (copy_from_user(&args, (const void __user *)arg, if (copy_from_user(&args, (const void __user *)arg,
sizeof(args)) != 0) { sizeof(args))) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -1403,9 +1397,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -1403,9 +1397,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case VCHIQ_IOC_SET_SERVICE_OPTION: { case VCHIQ_IOC_SET_SERVICE_OPTION: {
struct vchiq_set_service_option args; struct vchiq_set_service_option args;
if (copy_from_user( if (copy_from_user(&args, (const void __user *)arg,
&args, (const void __user *)arg, sizeof(args))) {
sizeof(args)) != 0) {
ret = -EFAULT; ret = -EFAULT;
break; break;
} }
...@@ -2329,8 +2322,7 @@ vchiq_keepalive_thread_func(void *v) ...@@ -2329,8 +2322,7 @@ vchiq_keepalive_thread_func(void *v)
while (1) { while (1) {
long rc = 0, uc = 0; long rc = 0, uc = 0;
if (wait_for_completion_interruptible(&arm_state->ka_evt) if (wait_for_completion_interruptible(&arm_state->ka_evt)) {
!= 0) {
vchiq_log_error(vchiq_susp_log_level, vchiq_log_error(vchiq_susp_log_level,
"%s interrupted", __func__); "%s interrupted", __func__);
flush_signals(current); flush_signals(current);
...@@ -3011,7 +3003,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, ...@@ -3011,7 +3003,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
vchiq_log_info(vchiq_susp_log_level, "%s %s resume " vchiq_log_info(vchiq_susp_log_level, "%s %s resume "
"blocked - waiting...", __func__, entity); "blocked - waiting...", __func__, entity);
if (wait_for_completion_killable( if (wait_for_completion_killable(
&arm_state->resume_blocker) != 0) { &arm_state->resume_blocker)) {
vchiq_log_error(vchiq_susp_log_level, "%s %s " vchiq_log_error(vchiq_susp_log_level, "%s %s "
"wait for resume blocker interrupted", "wait for resume blocker interrupted",
__func__, entity); __func__, entity);
...@@ -3060,7 +3052,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, ...@@ -3060,7 +3052,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume", vchiq_log_info(vchiq_susp_log_level, "%s %s wait for resume",
__func__, entity); __func__, entity);
if (wait_for_completion_killable( if (wait_for_completion_killable(
&arm_state->vc_resume_complete) != 0) { &arm_state->vc_resume_complete)) {
vchiq_log_error(vchiq_susp_log_level, "%s %s wait for " vchiq_log_error(vchiq_susp_log_level, "%s %s wait for "
"resume interrupted", __func__, entity); "resume interrupted", __func__, entity);
ret = VCHIQ_ERROR; ret = VCHIQ_ERROR;
...@@ -3505,13 +3497,13 @@ static int vchiq_probe(struct platform_device *pdev) ...@@ -3505,13 +3497,13 @@ static int vchiq_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, drvdata); platform_set_drvdata(pdev, drvdata);
err = vchiq_platform_init(pdev, &g_state); err = vchiq_platform_init(pdev, &g_state);
if (err != 0) if (err)
goto failed_platform_init; goto failed_platform_init;
cdev_init(&vchiq_cdev, &vchiq_fops); cdev_init(&vchiq_cdev, &vchiq_fops);
vchiq_cdev.owner = THIS_MODULE; vchiq_cdev.owner = THIS_MODULE;
err = cdev_add(&vchiq_cdev, vchiq_devid, 1); err = cdev_add(&vchiq_cdev, vchiq_devid, 1);
if (err != 0) { if (err) {
vchiq_log_error(vchiq_arm_log_level, vchiq_log_error(vchiq_arm_log_level,
"Unable to register device"); "Unable to register device");
goto failed_platform_init; goto failed_platform_init;
......
...@@ -41,7 +41,7 @@ void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback) ...@@ -41,7 +41,7 @@ void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback)
{ {
connected_init(); connected_init();
if (mutex_lock_killable(&g_connected_mutex) != 0) if (mutex_lock_killable(&g_connected_mutex))
return; return;
if (g_connected) if (g_connected)
...@@ -76,7 +76,7 @@ void vchiq_call_connected_callbacks(void) ...@@ -76,7 +76,7 @@ void vchiq_call_connected_callbacks(void)
connected_init(); connected_init();
if (mutex_lock_killable(&g_connected_mutex) != 0) if (mutex_lock_killable(&g_connected_mutex))
return; return;
for (i = 0; i < g_num_deferred_callbacks; i++) for (i = 0; i < g_num_deferred_callbacks; i++)
......
...@@ -800,7 +800,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, ...@@ -800,7 +800,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
WARN_ON(!(stride <= VCHIQ_SLOT_SIZE)); WARN_ON(!(stride <= VCHIQ_SLOT_SIZE));
if (!(flags & QMFLAGS_NO_MUTEX_LOCK) && if (!(flags & QMFLAGS_NO_MUTEX_LOCK) &&
(mutex_lock_killable(&state->slot_mutex) != 0)) mutex_lock_killable(&state->slot_mutex))
return VCHIQ_RETRY; return VCHIQ_RETRY;
if (type == VCHIQ_MSG_DATA) { if (type == VCHIQ_MSG_DATA) {
...@@ -812,8 +812,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, ...@@ -812,8 +812,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
return VCHIQ_ERROR; return VCHIQ_ERROR;
} }
WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
QMFLAGS_NO_MUTEX_UNLOCK)) != 0); QMFLAGS_NO_MUTEX_UNLOCK));
if (service->closing) { if (service->closing) {
/* The service has been closed */ /* The service has been closed */
...@@ -874,7 +874,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, ...@@ -874,7 +874,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
return VCHIQ_RETRY; return VCHIQ_RETRY;
if (service->closing) if (service->closing)
return VCHIQ_ERROR; return VCHIQ_ERROR;
if (mutex_lock_killable(&state->slot_mutex) != 0) if (mutex_lock_killable(&state->slot_mutex))
return VCHIQ_RETRY; return VCHIQ_RETRY;
if (service->srvstate != VCHIQ_SRVSTATE_OPEN) { if (service->srvstate != VCHIQ_SRVSTATE_OPEN) {
/* The service has been closed */ /* The service has been closed */
...@@ -912,8 +912,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, ...@@ -912,8 +912,8 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
header, size, VCHIQ_MSG_SRCPORT(msgid), header, size, VCHIQ_MSG_SRCPORT(msgid),
VCHIQ_MSG_DSTPORT(msgid)); VCHIQ_MSG_DSTPORT(msgid));
WARN_ON((flags & (QMFLAGS_NO_MUTEX_LOCK | WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
QMFLAGS_NO_MUTEX_UNLOCK)) != 0); QMFLAGS_NO_MUTEX_UNLOCK));
callback_result = callback_result =
copy_message_data(copy_callback, context, copy_message_data(copy_callback, context,
...@@ -1040,8 +1040,8 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, ...@@ -1040,8 +1040,8 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
local = state->local; local = state->local;
if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) && if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME &&
(mutex_lock_killable(&state->sync_mutex) != 0)) mutex_lock_killable(&state->sync_mutex))
return VCHIQ_RETRY; return VCHIQ_RETRY;
remote_event_wait(&state->sync_release_event, &local->sync_release); remote_event_wait(&state->sync_release_event, &local->sync_release);
...@@ -1718,8 +1718,7 @@ parse_rx_slots(struct vchiq_state *state) ...@@ -1718,8 +1718,7 @@ parse_rx_slots(struct vchiq_state *state)
&service->bulk_rx : &service->bulk_tx; &service->bulk_rx : &service->bulk_tx;
DEBUG_TRACE(PARSE_LINE); DEBUG_TRACE(PARSE_LINE);
if (mutex_lock_killable( if (mutex_lock_killable(&service->bulk_mutex)) {
&service->bulk_mutex) != 0) {
DEBUG_TRACE(PARSE_LINE); DEBUG_TRACE(PARSE_LINE);
goto bail_not_ready; goto bail_not_ready;
} }
...@@ -2523,7 +2522,7 @@ do_abort_bulks(struct vchiq_service *service) ...@@ -2523,7 +2522,7 @@ do_abort_bulks(struct vchiq_service *service)
VCHIQ_STATUS_T status; VCHIQ_STATUS_T status;
/* Abort any outstanding bulk transfers */ /* Abort any outstanding bulk transfers */
if (mutex_lock_killable(&service->bulk_mutex) != 0) if (mutex_lock_killable(&service->bulk_mutex))
return 0; return 0;
abort_outstanding_bulks(service, &service->bulk_tx); abort_outstanding_bulks(service, &service->bulk_tx);
abort_outstanding_bulks(service, &service->bulk_rx); abort_outstanding_bulks(service, &service->bulk_rx);
...@@ -3038,7 +3037,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ...@@ -3038,7 +3037,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
queue = (dir == VCHIQ_BULK_TRANSMIT) ? queue = (dir == VCHIQ_BULK_TRANSMIT) ?
&service->bulk_tx : &service->bulk_rx; &service->bulk_tx : &service->bulk_rx;
if (mutex_lock_killable(&service->bulk_mutex) != 0) { if (mutex_lock_killable(&service->bulk_mutex)) {
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
goto error_exit; goto error_exit;
} }
...@@ -3052,8 +3051,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ...@@ -3052,8 +3051,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
goto error_exit; goto error_exit;
} }
if (mutex_lock_killable(&service->bulk_mutex) if (mutex_lock_killable(&service->bulk_mutex)) {
!= 0) {
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
goto error_exit; goto error_exit;
} }
...@@ -3081,7 +3079,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, ...@@ -3081,7 +3079,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle,
/* The slot mutex must be held when the service is being closed, so /* The slot mutex must be held when the service is being closed, so
claim it here to ensure that isn't happening */ claim it here to ensure that isn't happening */
if (mutex_lock_killable(&state->slot_mutex) != 0) { if (mutex_lock_killable(&state->slot_mutex)) {
status = VCHIQ_RETRY; status = VCHIQ_RETRY;
goto cancel_bulk_error_exit; goto cancel_bulk_error_exit;
} }
......
...@@ -86,7 +86,7 @@ static ssize_t debugfs_log_write(struct file *file, ...@@ -86,7 +86,7 @@ static ssize_t debugfs_log_write(struct file *file,
if (count >= DEBUGFS_WRITE_BUF_SIZE) if (count >= DEBUGFS_WRITE_BUF_SIZE)
count = DEBUGFS_WRITE_BUF_SIZE; count = DEBUGFS_WRITE_BUF_SIZE;
if (copy_from_user(kbuf, buffer, count) != 0) if (copy_from_user(kbuf, buffer, count))
return -EFAULT; return -EFAULT;
kbuf[count - 1] = 0; kbuf[count - 1] = 0;
...@@ -151,7 +151,7 @@ static ssize_t debugfs_trace_write(struct file *file, ...@@ -151,7 +151,7 @@ static ssize_t debugfs_trace_write(struct file *file,
VCHIQ_INSTANCE_T instance = f->private; VCHIQ_INSTANCE_T instance = f->private;
char firstchar; char firstchar;
if (copy_from_user(&firstchar, buffer, 1) != 0) if (copy_from_user(&firstchar, buffer, 1))
return -EFAULT; return -EFAULT;
switch (firstchar) { switch (firstchar) {
......
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