qcacmn: Fix division by 0 in dp_get_kbps_to_mcs

For cases DP_11B_CCK_RATE, DP_11A_OFDM_RATE and
DP_11G_CCK_OFDM_RATE, variable num_mcs is not set and is
assigned 0 which is used as a divisor to get the MCS value.
To fix this, return 0 for above mentioned cases.

Change-Id: Ic1d2dce93a3aa55c323e1f75d30c5f9371822280
CRs-Fixed: 3479813
This commit is contained in:
Ananya Gupta
2023-04-26 13:11:21 +05:30
committed by Madan Koyyalamudi
parent 31ed81c9f7
commit 3c19803152

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016-2019, 2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -7011,21 +7011,14 @@ int dp_get_kbps_to_mcs(int kbps_rate, int shortgi, int htflag)
switch (htflag) {
/* 11b CCK Rates */
case DP_11B_CCK_RATE:
start_index = CCK_RATE_TABLE_INDEX;
end_index = CCK_RATE_TABLE_END_INDEX;
break;
fallthrough;
/* 11a OFDM Rates */
case DP_11A_OFDM_RATE:
start_index = OFDM_RATE_TABLE_INDEX;
end_index = OFDMA_RATE_TABLE_END_INDEX;
break;
fallthrough;
/* 11g CCK/OFDM Rates */
case DP_11G_CCK_OFDM_RATE:
start_index = CCK_RATE_TABLE_INDEX;
end_index = OFDMA_RATE_TABLE_END_INDEX;
break;
/* These rates dont have corresponding MCS, hence return 0 */
return 0;
/* HT rates only */
case DP_HT_RATE: