From cb24ba9b7972d6b7105a43bb489b0edd3c0847a5 Mon Sep 17 00:00:00 2001 From: Karthik Anantha Ram Date: Wed, 1 Jul 2020 12:38:18 -0700 Subject: [PATCH] msm: camera: common: Return appropriate error code for cancelled requests If a request is submitted post flush and the request ID of that request is <= last flush req ID return an appropriate error code to indicate the same. CRs-Fixed: 2720555 Change-Id: Ic26c4fc5f0ba490ed277b3bb301cc02d1fa027d6 Signed-off-by: Karthik Anantha Ram Signed-off-by: Mukund Madhusudan Atre --- drivers/cam_core/cam_context_utils.c | 2 +- drivers/cam_req_mgr/cam_req_mgr_core.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/cam_core/cam_context_utils.c b/drivers/cam_core/cam_context_utils.c index 5b09d1183d7a..28d7827391db 100644 --- a/drivers/cam_core/cam_context_utils.c +++ b/drivers/cam_core/cam_context_utils.c @@ -396,7 +396,7 @@ int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx, CAM_ERR(CAM_CORE, "request %lld has been flushed, reject packet", packet->header.request_id); - rc = -EINVAL; + rc = -EBADR; goto free_req; } diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index 9b2f458fa44f..665f67816a21 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -2829,8 +2829,17 @@ static int cam_req_mgr_cb_add_req(struct cam_req_mgr_add_request *add_req) /* Validate if req id is present in input queue */ idx = __cam_req_mgr_find_slot_for_req(link->req.in_q, add_req->req_id); if (idx < 0) { - CAM_ERR(CAM_CRM, "req %lld not found in in_q", add_req->req_id); - rc = -ENOENT; + if (((uint32_t)add_req->req_id) <= (link->last_flush_id)) { + CAM_ERR(CAM_CRM, + "req %lld not found in in_q; it has been flushed [last_flush_req %u]", + add_req->req_id, link->last_flush_id); + rc = -EBADR; + } else { + CAM_ERR(CAM_CRM, + "req %lld not found in in_q", + add_req->req_id); + rc = -ENOENT; + } goto end; }