diff options
| author | Umang Jain <umang.jain@ideasonboard.com> | 2024-09-18 22:00:58 +0530 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-10-09 11:58:47 +0200 |
| commit | 80f8ea98e43e2b3e62c576af0a60efba9608d8f1 (patch) | |
| tree | 1e51a0861c8b7ecc70f1b2484fcd695964de5147 /drivers/staging | |
| parent | 72925dec88342c50ca3a39c91f6614d6921bb46f (diff) | |
staging: vchiq_core: Return -EINTR when bulk transfers are interrupted
Bulk transfers for various VCHIQ modes use mutex_lock_killable() and
wait_for_completion_killable() variations. Currently, -EAGAIN is
returned if these are interrupted by a fatal signal.
-EAGAIN may mislead the caller into thinking the operation can be
retried, while in reality, the process has received a fatal signal
and is terminating. Therefore, we should update the return value to
align with what these killable functions would return, specifically
-EINTR (Interrupted system call).
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Link: https://lore.kernel.org/r/20240918163100.870596-5-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
| -rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 | ||||
| -rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 12 |
2 files changed, 10 insertions, 10 deletions
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 3d469b88a118..d4c70a220b9e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -870,11 +870,11 @@ vchiq_bulk_transmit(struct vchiq_instance *instance, unsigned int handle, const } /* - * vchiq_*_bulk_transfer() may return -EAGAIN, so we need + * vchiq_*_bulk_transfer() may return -EINTR, so we need * to implement a retry mechanism since this function is * supposed to block until queued */ - if (ret != -EAGAIN) + if (ret != -EINTR) break; msleep(1); @@ -906,11 +906,11 @@ int vchiq_bulk_receive(struct vchiq_instance *instance, unsigned int handle, } /* - * vchiq_*_bulk_transfer() may return -EAGAIN, so we need + * vchiq_*_bulk_transfer() may return -EINTR, so we need * to implement a retry mechanism since this function is * supposed to block until queued */ - if (ret != -EAGAIN) + if (ret != -EINTR) break; msleep(1); 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 d7b22e37c2ff..426e729b71ee 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2689,16 +2689,16 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_service *service, &service->bulk_tx : &service->bulk_rx; if (mutex_lock_killable(&service->bulk_mutex)) - return -EAGAIN; + return -EINTR; if (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS) { VCHIQ_SERVICE_STATS_INC(service, bulk_stalls); do { mutex_unlock(&service->bulk_mutex); if (wait_for_completion_killable(&service->bulk_remove_event)) - return -EAGAIN; + return -EINTR; if (mutex_lock_killable(&service->bulk_mutex)) - return -EAGAIN; + return -EINTR; } while (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS); } @@ -2729,7 +2729,7 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_service *service, * claim it here to ensure that isn't happening */ if (mutex_lock_killable(&state->slot_mutex)) { - status = -EAGAIN; + status = -EINTR; goto cancel_bulk_error_exit; } @@ -2764,7 +2764,7 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_service *service, if (bulk_waiter) { bulk_waiter->bulk = bulk; if (wait_for_completion_killable(&bulk_waiter->event)) - status = -EAGAIN; + status = -EINTR; else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) status = -EINVAL; } @@ -3203,7 +3203,7 @@ vchiq_bulk_xfer_waiting(struct vchiq_instance *instance, status = 0; if (wait_for_completion_killable(&bulk_waiter->event)) - return -EAGAIN; + return -EINTR; else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED) return -EINVAL; |
