mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 02:01:36 +03:00
Dereference after null check for pointers cl and handlep. Add a null check before referencing cl and handlep. Check return value of request_firmware for error. Using uninitialized value event when calling dce_worker_thread_wait. Add EVENT_ID_DCE_INVALID_EVENT and have a check before using the value event. CID 10127898 CID 10127999 CID 10127954 CID 10127811 Bug 3461002 Change-Id: If00ece28fd52e495b3a8d3eec7bdb4825d3c7892 Signed-off-by: Prateek Patel <prpatel@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2661588 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> GVS: Gerrit_Virtual_Submit
83 lines
2.4 KiB
C
83 lines
2.4 KiB
C
/*
|
|
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms and conditions of the GNU General Public License,
|
|
* version 2, as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*/
|
|
|
|
#ifndef DCE_WORKER_H
|
|
#define DCE_WORKER_H
|
|
|
|
#include <dce-cond.h>
|
|
#include <dce-lock.h>
|
|
#include <dce-thread.h>
|
|
|
|
struct tegra_dce;
|
|
|
|
/**
|
|
* enum dce_worker_event_id_type - IDs to be used to convey various
|
|
* events thoughout the life cycle of dce worker thread.
|
|
*/
|
|
enum dce_worker_event_id_type {
|
|
EVENT_ID_DCE_INVALID_EVENT = -1,
|
|
EVENT_ID_DCE_BOOT_COMPLETE_IRQ_REQ_SET = 0,
|
|
EVENT_ID_DCE_BOOT_COMPLETE_IRQ_RECEIVED = 1,
|
|
EVENT_ID_DCE_IPC_SYNC_TRIGGERED = 2,
|
|
EVENT_ID_DCE_IPC_MESSAGE_SENT = 3,
|
|
EVENT_ID_DCE_IPC_SIGNAL_RECEIVED = 4,
|
|
EVENT_ID_DCE_THREAD_ABORT_REQ_RECEIVED = 5,
|
|
EVENT_ID_DCE_INTERFACE_ERROR_RECEIVED = 6,
|
|
EVENT_ID_DCE_BOOT_COMPLETE = 7,
|
|
};
|
|
|
|
/**
|
|
* dce_worker_state - Different states of dce worker thread.
|
|
*/
|
|
enum dce_worker_state {
|
|
STATE_DCE_WORKER_IDLE = 0,
|
|
STATE_DCE_WORKER_BOOT_WAIT = 1,
|
|
STATE_DCE_WORKER_WFI = 2,
|
|
STATE_DCE_WORKER_ABORTED = 3,
|
|
STATE_DCE_WORKER_HANDLE_DCE_ERROR = 4,
|
|
};
|
|
|
|
/**
|
|
* struct dce_worker_info - Contains information to control and manage
|
|
* dce worker thread throughout its lifecycle.
|
|
* @wrk_thread : Event driven dce thread to manage initilaization and
|
|
* release workflow.
|
|
* @state_changed : Boolean to convey state changes.
|
|
* @c_state : Stores the current state of dce worker thread. State changes
|
|
* are triggered by vrious events.
|
|
* @lock : Used for exclusive state modifications from thread and
|
|
* interrupt context.
|
|
* @cond : dce_cond to manage various thread states.
|
|
*/
|
|
struct dce_worker_info {
|
|
struct dce_thread wrk_thread;
|
|
bool state_changed;
|
|
enum dce_worker_state c_state;
|
|
struct dce_mutex lock;
|
|
struct dce_cond cond;
|
|
};
|
|
|
|
void dce_worker_thread_wait(struct tegra_dce *d,
|
|
enum dce_worker_event_id_type event);
|
|
|
|
void dce_worker_thread_wakeup(struct tegra_dce *d,
|
|
enum dce_worker_event_id_type event);
|
|
|
|
enum dce_worker_state dce_worker_get_state(struct tegra_dce *d);
|
|
|
|
int dce_worker_thread_init(struct tegra_dce *d);
|
|
|
|
void dce_worker_thread_deinit(struct tegra_dce *d);
|
|
|
|
#endif
|