platform: tegra: dce: fix coverity defect

- check the handle is valid before retrieving the
client structure for the handle during client unregister.

Bug 3952896

Change-Id: I6f37625e01453055fb4dc256cffb1f85f199aa36
Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2922622
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Santosh Reddy Galma
2023-06-19 15:33:38 +00:00
committed by mobile promotions
parent e4f4ae06b6
commit ebbb6ea7a2

View File

@@ -203,7 +203,11 @@ int tegra_dce_unregister_ipc_client(u32 handle)
{ {
struct tegra_dce_client_ipc *cl; struct tegra_dce_client_ipc *cl;
cl = &client_handles[client_handle_to_index(handle)]; cl = dce_client_ipc_lookup_handle(handle);
if (cl == NULL) {
return -EINVAL;
}
dce_cond_destroy(&cl->recv_wait); dce_cond_destroy(&cl->recv_wait);
return dce_client_ipc_handle_free(handle); return dce_client_ipc_handle_free(handle);