diff --git a/drivers/platform/tegra/dce/dce-admin.c b/drivers/platform/tegra/dce/dce-admin.c index 1d76cfbb..32679d6d 100644 --- a/drivers/platform/tegra/dce/dce-admin.c +++ b/drivers/platform/tegra/dce/dce-admin.c @@ -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; diff --git a/drivers/platform/tegra/dce/dce-bootstrap.c b/drivers/platform/tegra/dce/dce-bootstrap.c index 3c4d04f6..1dcb2652 100644 --- a/drivers/platform/tegra/dce/dce-bootstrap.c +++ b/drivers/platform/tegra/dce/dce-bootstrap.c @@ -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) diff --git a/drivers/platform/tegra/dce/dce-fsm.c b/drivers/platform/tegra/dce/dce-fsm.c index bcc2105f..8a4dda02 100644 --- a/drivers/platform/tegra/dce/dce-fsm.c +++ b/drivers/platform/tegra/dce/dce-fsm.c @@ -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; } diff --git a/drivers/platform/tegra/dce/dce-pm.c b/drivers/platform/tegra/dce/dce-pm.c index 241ce896..46d15ef6 100644 --- a/drivers/platform/tegra/dce/dce-pm.c +++ b/drivers/platform/tegra/dce/dce-pm.c @@ -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; diff --git a/drivers/platform/tegra/dce/include/dce.h b/drivers/platform/tegra/dce/include/dce.h index a2680de4..154f882b 100644 --- a/drivers/platform/tegra/dce/include/dce.h +++ b/drivers/platform/tegra/dce/include/dce.h @@ -20,6 +20,13 @@ #include #include +#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 /**