[DTV00857290][DTV][Coverity Scanned Code Defect]
[Description]
Fix coverity defects under nic/nic_rate.c
Fix Uninitialized scalar variable
- Cid#361785 in line 411
- Cid#361786 in line 415
Change-Id: I9893058c93360d641b9db1551aa609d441c23d22
Signed-off-by: Alice Ou <alice.ou@mediatek.com>
CR-Id: DTV00857290
(cherry picked from commit 53deb4db2b84c6d71eedb65b76c9d60534761192)
(cherry picked from commit 07154a7fbc401ba110190313979e38e8aec08ea1)
(cherry picked from commit 7264436c1cf9b361682b8fa680ece35388ca7490)
diff --git a/nic/nic_rate.c b/nic/nic_rate.c
index b592c7f..938a3ed 100644
--- a/nic/nic_rate.c
+++ b/nic/nic_rate.c
@@ -408,22 +408,21 @@
u4CurPhyRate =
nicRateCode2DataRate(u2CurRateCode, MAC_BW_20, MAC_GI_NORMAL);
- if (u4HighestPhyRate < u4CurPhyRate) {
- u4HighestPhyRate = u4CurPhyRate;
- ucHighestPhyRateSwIdx = i;
- }
- if (u4LowestPhyRate > u4CurPhyRate) {
- u4LowestPhyRate = u4CurPhyRate;
- ucLowestPhyRateSwIdx = i;
- }
-
/* Compare */
if (fgGetLowest) {
+ if (u4HighestPhyRate < u4CurPhyRate) {
+ u4HighestPhyRate = u4CurPhyRate;
+ ucHighestPhyRateSwIdx = i;
+ }
if ((u4CurPhyRate >= u4PhyRateLimit) && (u4CurPhyRate <= u4TarPhyRate)) {
u4TarPhyRate = u4CurPhyRate;
ucTarRateSwIndex = i;
}
} else {
+ if (u4LowestPhyRate > u4CurPhyRate) {
+ u4LowestPhyRate = u4CurPhyRate;
+ ucLowestPhyRateSwIdx = i;
+ }
if ((u4CurPhyRate <= u4PhyRateLimit) && (u4CurPhyRate >= u4TarPhyRate)) {
u4TarPhyRate = u4CurPhyRate;
ucTarRateSwIndex = i;