qcacmn: Do not allocate memory of size zero

In a few scenarios, the number of reg rules can be 0.  For example,
for  a  2Ghz-only radio  there are no 5Ghz reg rules.  In such cases,
if we try to allocate memory (0 bytes) the allocation function prints
an error message. Also, the allocation is not required. Therefore, avoid
the allocation when the number of rules is zero.

Change-Id: Ic9caf578541970e9cf12cdde181f23762f137db8
CRs-Fixed: 2622109
This commit is contained in:
Ananya Barat
2020-02-14 13:55:43 +05:30
zatwierdzone przez nshrivas
rodzic d3a6d13d9f
commit cbee232e21

Wyświetl plik

@@ -11194,7 +11194,11 @@ static struct cur_reg_rule
struct cur_reg_rule *reg_rule_ptr; struct cur_reg_rule *reg_rule_ptr;
uint32_t count; uint32_t count;
reg_rule_ptr = qdf_mem_malloc(num_reg_rules * sizeof(*reg_rule_ptr)); if (!num_reg_rules)
return NULL;
reg_rule_ptr = qdf_mem_malloc(num_reg_rules *
sizeof(*reg_rule_ptr));
if (!reg_rule_ptr) if (!reg_rule_ptr)
return NULL; return NULL;