x86: make tests of a value against zero should be made explicit

Tests of a value against zero should be made explicit, unless the
operand is effectively Boolean. This is based on MISRA rule 14.4.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2021-03-29 17:13:18 -04:00
commit 0630452890
5 changed files with 6 additions and 6 deletions

View file

@ -154,14 +154,14 @@ int get_value(const struct device *dev, uint32_t *ticks)
* the HOUR_PM flag before we adjust for BCD.
*/
if (state.status_b & STATUS_B_24HR) {
if ((state.status_b & STATUS_B_24HR) != 0U) {
pm = false;
} else {
pm = ((state.hour & HOUR_PM) == HOUR_PM);
state.hour &= ~HOUR_PM;
}
if (!(state.status_b & STATUS_B_BIN)) {
if ((state.status_b & STATUS_B_BIN) == 0U) {
uint8_t *cp = (uint8_t *) &state;
int i;