In case there is no service pointer provided, we can skip these polling. Use a goto to reduce the indentation, which is necessary for the following patches. Btw fix the brace alignment of the loops. Signed-off-by: Stefan Wahren <stefan.wahren@xxxxxxxx> --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index e67ba54..be0ea1e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -538,21 +538,22 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service, { u32 value; - if (service) { - do { - value = atomic_read(&service->poll_flags); - } while (atomic_cmpxchg(&service->poll_flags, value, - value | BIT(poll_type)) != value); + if (!service) + goto skip_service; - do { - value = atomic_read(&state->poll_services[ - service->localport>>5]); - } while (atomic_cmpxchg( - &state->poll_services[service->localport>>5], - value, value | BIT(service->localport & 0x1f)) - != value); - } + do { + value = atomic_read(&service->poll_flags); + } while (atomic_cmpxchg(&service->poll_flags, value, + value | BIT(poll_type)) != value); + + do { + value = atomic_read(&state->poll_services[ + service->localport>>5]); + } while (atomic_cmpxchg( + &state->poll_services[service->localport>>5], value, + value | BIT(service->localport & 0x1f)) != value); +skip_service: state->poll_needed = 1; wmb(); -- 2.7.4