qcacmn: Provide reason to QDF_DEBUG_PANIC()

A common pattern in WLAN to panic the driver is to log the reason and
then unconditionally panic. QDF_DEBUG_PANIC() takes a reason string to
help make the reason for the panic more obvious, but it is not always
used. Ensure all callers of QDF_DEBUG_PANIC() provide a reason string.

Additionally, make the reason string parameter of QDF_DEBUG_PANIC()
mandatory.

Change-Id: Ia3c7acfe590f7f465823fff3f2393653b2d20fe5
CRs-Fixed: 2403830
This commit is contained in:
Dustin Brown
2019-02-22 10:58:48 -08:00
committed by nshrivas
parent 79f6d9e609
commit d33659b98d
2 changed files with 12 additions and 11 deletions

View File

@@ -278,12 +278,13 @@ static inline void __qdf_bug(void)
/** /**
* QDF_DEBUG_PANIC() - In debug builds, panic, otherwise do nothing * QDF_DEBUG_PANIC() - In debug builds, panic, otherwise do nothing
* @reason: An optional reason format string, followed by args * @reason_fmt: a format string containing the reason for the panic
* @args: zero or more printf compatible logging arguments
* *
* Return: None * Return: None
*/ */
#define QDF_DEBUG_PANIC(reason...) \ #define QDF_DEBUG_PANIC(reason_fmt, args...) \
QDF_DEBUG_PANIC_FL(__func__, __LINE__, "" reason) QDF_DEBUG_PANIC_FL(__func__, __LINE__, reason_fmt, ## args)
/** /**
* QDF_DEBUG_PANIC_FL() - In debug builds, panic, otherwise do nothing * QDF_DEBUG_PANIC_FL() - In debug builds, panic, otherwise do nothing

View File

@@ -1555,8 +1555,8 @@ wmi_buf_t wmi_buf_alloc_fl(wmi_unified_t wmi_handle, uint32_t len,
wmi_buf_t wmi_buf; wmi_buf_t wmi_buf;
if (roundup(len + WMI_MIN_HEAD_ROOM, 4) > wmi_handle->max_msg_len) { if (roundup(len + WMI_MIN_HEAD_ROOM, 4) > wmi_handle->max_msg_len) {
wmi_nofl_err("%s:%d, Invalid len:%d", func, line, len); QDF_DEBUG_PANIC("Invalid length %u (via %s:%u)",
QDF_DEBUG_PANIC(); len, func, line);
return NULL; return NULL;
} }
@@ -1579,6 +1579,7 @@ wmi_buf_t wmi_buf_alloc_fl(wmi_unified_t wmi_handle, uint32_t len,
* Set the length of the buffer to match the allocation size. * Set the length of the buffer to match the allocation size.
*/ */
qdf_nbuf_set_pktlen(wmi_buf, len); qdf_nbuf_set_pktlen(wmi_buf, len);
return wmi_buf; return wmi_buf;
} }
qdf_export_symbol(wmi_buf_alloc_fl); qdf_export_symbol(wmi_buf_alloc_fl);
@@ -1666,15 +1667,14 @@ QDF_STATUS wmi_unified_cmd_send_fl(wmi_unified_t wmi_handle, wmi_buf_t buf,
uint16_t htc_tag = 0; uint16_t htc_tag = 0;
if (wmi_get_runtime_pm_inprogress(wmi_handle)) { if (wmi_get_runtime_pm_inprogress(wmi_handle)) {
htc_tag = htc_tag = wmi_handle->ops->wmi_set_htc_tx_tag(wmi_handle, buf,
(uint16_t)wmi_handle->ops->wmi_set_htc_tx_tag( cmd_id);
wmi_handle, buf, cmd_id);
} else if (qdf_atomic_read(&wmi_handle->is_target_suspended) && } else if (qdf_atomic_read(&wmi_handle->is_target_suspended) &&
(!wmi_is_pm_resume_cmd(cmd_id))) { !wmi_is_pm_resume_cmd(cmd_id)) {
wmi_nofl_err("%s:%d, Target is suspended", func, line); QDF_DEBUG_PANIC("Target is suspended (via %s:%u)", func, line);
QDF_DEBUG_PANIC();
return QDF_STATUS_E_BUSY; return QDF_STATUS_E_BUSY;
} }
if (wmi_handle->wmi_stopinprogress) { if (wmi_handle->wmi_stopinprogress) {
wmi_nofl_err("%s:%d, WMI stop in progress", func, line); wmi_nofl_err("%s:%d, WMI stop in progress", func, line);
return QDF_STATUS_E_INVAL; return QDF_STATUS_E_INVAL;