google_bms: correct GBMS_CCCM_LIMITS() #define
Add parenthesis around GBMS_CCCM_LIMITS() to fix operator precedence
when the definition is used in expressions.
Bug: 239769293
Signed-off-by: Jenny Ho <[email protected]>
Change-Id: Ic628cd16d027db14bc31f977450bb6fb7205fab3
diff --git a/google_bms.h b/google_bms.h
index 83fb5bc..58ffaa4 100644
--- a/google_bms.h
+++ b/google_bms.h
@@ -363,10 +363,10 @@
};
#define GBMS_CCCM_LIMITS_SET(profile, ti, vi) \
- profile->cccm_limits[(ti * profile->volt_nb_limits) + vi]
+ profile->cccm_limits[((ti) * profile->volt_nb_limits) + (vi)]
#define GBMS_CCCM_LIMITS(profile, ti, vi) \
- (ti >= 0 && vi >= 0) ? profile->cccm_limits[(ti * profile->volt_nb_limits) + vi] : 0
+ (((ti) >= 0 && (vi) >= 0) ? profile->cccm_limits[((ti) * profile->volt_nb_limits) + (vi)] : 0)
/* newgen charging */
#define GBMS_CS_FLAG_BUCK_EN BIT(0)