Skip to content

Commit 4a8ff7e

Browse files
committed
staging: mmal-vchiq: Clean up a load of !=0 and == 0 conditionals
Replace several instances of if (foo == 0) with if (!foo) and if (foo != 0) with if (foo) Signed-off-by: Dave Stevenson <[email protected]>
1 parent c68979a commit 4a8ff7e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static void buffer_to_host_work_cb(struct work_struct *work)
344344

345345
vchiq_release_service(instance->service_handle);
346346

347-
if (ret != 0)
347+
if (ret)
348348
pr_err("%s: ctx: %p, vchiq_bulk_receive failed %d\n",
349349
__func__, msg_context, ret);
350350
}
@@ -669,7 +669,7 @@ static void buffer_to_host_cb(struct vchiq_mmal_instance *instance,
669669
/* data is not in message, queue a bulk receive */
670670
msg_context->u.bulk.status =
671671
bulk_receive(instance, msg, msg_context);
672-
if (msg_context->u.bulk.status == 0)
672+
if (!msg_context->u.bulk.status)
673673
return; /* successful bulk submission, bulk
674674
* completion will trigger callback
675675
*/
@@ -862,7 +862,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
862862

863863
timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt,
864864
SYNC_MSG_TIMEOUT * HZ);
865-
if (timeout == 0) {
865+
if (!timeout) {
866866
pr_err("timed out waiting for sync completion\n");
867867
ret = -ETIME;
868868
/* todo: what happens if the message arrives after aborting */
@@ -1030,7 +1030,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance,
10301030
if (ret != MMAL_MSG_STATUS_SUCCESS)
10311031
goto release_msg;
10321032

1033-
if (rmsg->u.port_info_get_reply.port.is_enabled == 0)
1033+
if (!rmsg->u.port_info_get_reply.port.is_enabled)
10341034
port->enabled = 0;
10351035
else
10361036
port->enabled = 1;
@@ -1507,7 +1507,7 @@ static int port_disable(struct vchiq_mmal_instance *instance,
15071507

15081508
ret = port_action_port(instance, port,
15091509
MMAL_MSG_PORT_ACTION_TYPE_DISABLE);
1510-
if (ret == 0) {
1510+
if (!ret) {
15111511
port_return_buffers(instance, port, port->buffer_cb);
15121512

15131513
ret = port_info_get(instance, port);
@@ -2062,7 +2062,7 @@ int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance,
20622062
}
20632063

20642064
ret = enable_component(instance, component);
2065-
if (ret == 0)
2065+
if (!ret)
20662066
component->enabled = 1;
20672067

20682068
mutex_unlock(&instance->vchiq_mutex);
@@ -2088,7 +2088,7 @@ int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance,
20882088
}
20892089

20902090
ret = disable_component(instance, component);
2091-
if (ret == 0)
2091+
if (!ret)
20922092
component->enabled = 0;
20932093

20942094
mutex_unlock(&instance->vchiq_mutex);
@@ -2126,7 +2126,7 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance)
21262126
vchiq_use_service(instance->service_handle);
21272127

21282128
status = vchiq_close_service(instance->service_handle);
2129-
if (status != 0)
2129+
if (status)
21302130
pr_err("mmal-vchiq: VCHIQ close failed\n");
21312131

21322132
mutex_unlock(&instance->vchiq_mutex);

0 commit comments

Comments
 (0)