diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 71b962777da5..01125d9f991b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -432,6 +432,7 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data, struct vchiq_service *service; enum vchiq_status status; struct bulk_waiter_node *waiter = NULL; + bool found = false; service = find_service_by_handle(handle); if (!service) @@ -445,12 +446,13 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data, list_for_each_entry(waiter, &instance->bulk_waiter_list, list) { if (waiter->pid == current->pid) { list_del(&waiter->list); + found = true; break; } } mutex_unlock(&instance->bulk_waiter_list_mutex); - if (waiter) { + if (found) { struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk; if (bulk) { @@ -467,9 +469,7 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data, spin_unlock(&bulk_waiter_spinlock); } } - } - - if (!waiter) { + } else { waiter = kzalloc(sizeof(struct bulk_waiter_node), GFP_KERNEL); if (!waiter) { vchiq_log_error(vchiq_core_log_level, @@ -952,6 +952,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, { struct vchiq_service *service; struct bulk_waiter_node *waiter = NULL; + bool found = false; void *userdata = NULL; int status = 0; int ret; @@ -975,11 +976,12 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, list) { if (waiter->pid == current->pid) { list_del(&waiter->list); + found = true; break; } } mutex_unlock(&instance->bulk_waiter_list_mutex); - if (!waiter) { + if (!found) { vchiq_log_error(vchiq_arm_log_level, "no bulk_waiter found for pid %d", current->pid);