qcacmn: Add Null checks in CDP Layer

Part-2: Add Null checks for all the API's in
CDP Layer.

Change-Id: I8a4628f79880aff1212dee132016e8e48fe721fc
CRs-Fixed: 2136173
This commit is contained in:
Venkata Sharath Chandra Manchala
2017-10-25 12:18:08 -07:00
committed by snandini
parent aa62ae7615
commit c4a6b8480b
8 changed files with 475 additions and 124 deletions

View File

@@ -36,18 +36,37 @@
static inline void
cdp_clear_stats(ol_txrx_soc_handle soc, uint16_t bitmap)
{
if (soc->ops->mob_stats_ops->clear_stats)
return soc->ops->mob_stats_ops->clear_stats(bitmap);
return;
if (!soc || !soc->ops) {
QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
"%s: Invalid Instance", __func__);
QDF_BUG(0);
return;
}
if (!soc->ops->mob_stats_ops ||
!soc->ops->mob_stats_ops->clear_stats)
return;
soc->ops->mob_stats_ops->clear_stats(bitmap);
}
static inline int
cdp_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, char *buffer,
unsigned int buf_len)
{
if (soc->ops->mob_stats_ops->stats)
return soc->ops->mob_stats_ops->stats(vdev_id, buffer, buf_len);
return 0;
if (!soc || !soc->ops) {
QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
"%s: Invalid Instance", __func__);
QDF_BUG(0);
return 0;
}
if (!soc->ops->mob_stats_ops ||
!soc->ops->mob_stats_ops->stats)
return 0;
return soc->ops->mob_stats_ops->stats(vdev_id, buffer, buf_len);
}
#endif /* _CDP_TXRX_STATS_H_ */