DCE-KMD: Add helper macro to check non NULL

- This is a follow-up CL to address a comment in
  I885348a09eaac6e4362c89b59880fbd32d77d3b5

- This change will add a  helper macro, DCE_WARN_ON_NOT_NULL(x),
  to print a warning message if the input param is not NULL.
    - Added to dce.h

JIRA TDS-16126

Change-Id: I9b2c4ea89fa1682d18c20f68b14ab7696917f261
Signed-off-by: anupamg <anupamg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3251828
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
This commit is contained in:
anupamg
2024-11-18 15:11:50 -08:00
committed by Jon Hunter
parent 46895eb9cd
commit 0becc78306
5 changed files with 17 additions and 20 deletions

View File

@@ -337,8 +337,7 @@ out:
int dce_admin_handle_ipc_received_event(struct tegra_dce *d, void *params)
{
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
dce_os_wakeup_interruptible(d, DCE_WAIT_ADMIN_IPC);
return 0;

View File

@@ -69,8 +69,7 @@ int dce_handle_boot_cmd_requested_event(struct tegra_dce *d, void *params)
*/
int dce_handle_boot_cmd_received_event(struct tegra_dce *d, void *params)
{
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
dce_os_wakeup_interruptible(d, DCE_WAIT_BOOT_CMD);
return 0;
@@ -91,8 +90,7 @@ int dce_handle_boot_complete_requested_event(struct tegra_dce *d, void *params)
{
int ret = 0;
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
d->boot_status |= DCE_FW_EARLY_BOOT_START;
if (dce_fw_boot_complete(d)) {
@@ -139,8 +137,7 @@ boot_done:
*/
int dce_handle_boot_complete_received_event(struct tegra_dce *d, void *params)
{
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
dce_os_wakeup_interruptible(d, DCE_WAIT_BOOT_COMPLETE);
return 0;
@@ -301,8 +298,7 @@ static void dce_boot_interface_isr(struct tegra_dce *d, void *data)
u32 status;
u8 interface_id = DCE_MAILBOX_BOOT_INTERFACE;
if (data != NULL)
dce_os_warn(d, "Data param isn't expected in this function\n");
DCE_WARN_ON_NOT_NULL(data);
status = dce_mailbox_get_interface_status(d, interface_id);
if (status == 0xffffffff)

View File

@@ -94,8 +94,7 @@ static struct dce_event_process_struct event_process_table[] = {
*/
int dce_handle_fsm_start_event(struct tegra_dce *d, void *params)
{
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
return 0;
}
@@ -110,8 +109,7 @@ int dce_handle_fsm_start_event(struct tegra_dce *d, void *params)
*/
int dce_handle_event_stub(struct tegra_dce *d, void *params)
{
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
return 0;
}

View File

@@ -63,8 +63,7 @@ int dce_pm_handle_sc7_enter_requested_event(struct tegra_dce *d, void *params)
int ret = 0;
struct dce_ipc_message *msg = NULL;
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
msg = dce_get_admin_msg_buffer(d);
if (!msg) {
@@ -96,8 +95,7 @@ out:
*/
int dce_pm_handle_sc7_enter_received_event(struct tegra_dce *d, void *params)
{
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
dce_os_wakeup_interruptible(d, DCE_WAIT_SC7_ENTER);
return 0;
@@ -114,8 +112,7 @@ int dce_pm_handle_sc7_enter_received_event(struct tegra_dce *d, void *params)
*/
int dce_pm_handle_sc7_exit_received_event(struct tegra_dce *d, void *params)
{
if (params != NULL)
dce_os_warn(d, "Params aren't expected in this function\n");
DCE_WARN_ON_NOT_NULL(params);
dce_os_work_schedule(&d->dce_resume_work);
return 0;

View File

@@ -20,6 +20,13 @@
#include <dce-client-ipc-internal.h>
#include <dce-os-work.h>
#define DCE_WARN_ON_NOT_NULL(x) \
do { \
if (x != NULL) { \
dce_os_warn(d, "Unexpected non-NULL value for " #x "\n"); \
} \
} while (0)
#define DCE_MAX_CPU_IRQS 4
/**