msm: camera: core: Fix context release timing issue

When sync object is invalid and num_in_map > 1,
it will lead to context ref leak. Check sync
object first, then register sync call back.

CRs-Fixed: 2594185
Change-Id: I2d39ce3ea43bbe7bc05420b86b37fdfba4aa795a
Signed-off-by: Ayush Kumar <ayushkr@codeaurora.org>
This commit is contained in:
Ayush Kumar
2020-02-04 11:33:11 +05:30
committed by Karthik Anantha Ram
parent 5619d4e93e
commit 320ae57bb9
3 changed files with 58 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __CAM_SYNC_API_H__
@@ -140,6 +140,16 @@ int cam_sync_destroy(int32_t sync_obj);
*/
int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms);
/**
* @brief: Check if sync object is valid
*
* @param sync_obj: int referencing the sync object to be checked
*
* @return 0 upon success, -EINVAL if sync object is in bad state or arguments
* are invalid
*/
int cam_sync_check_valid(int32_t sync_obj);
/**
* @brief : API to register SYNC to platform framework.
* @return struct platform_device pointer on on success, or ERR_PTR() on error.