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:
parent
0ec3774bde
commit
0630452890
5 changed files with 6 additions and 6 deletions
|
@ -147,7 +147,7 @@ struct acpi_cpu *z_acpi_get_cpu(int n)
|
|||
if (entry->type == ACPI_MADT_ENTRY_CPU) {
|
||||
struct acpi_cpu *cpu = (struct acpi_cpu *)entry;
|
||||
|
||||
if (cpu->flags & ACPI_CPU_FLAGS_ENABLED) {
|
||||
if ((cpu->flags & ACPI_CPU_FLAGS_ENABLED) != 0) {
|
||||
if (n == 0) {
|
||||
return cpu;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void z_x86_early_serial_init(void)
|
|||
|
||||
early_serial_init_done = true;
|
||||
|
||||
if (suppressed_chars) {
|
||||
if (suppressed_chars != 0U) {
|
||||
printk("WARNING: %u chars lost before early serial init\n",
|
||||
suppressed_chars);
|
||||
}
|
||||
|
|
|
@ -518,7 +518,7 @@ static void print_entries(pentry_t entries_array[], uint8_t *base, int level,
|
|||
uintptr_t virt =
|
||||
(uintptr_t)base + (get_entry_scope(level) * i);
|
||||
|
||||
if (entry & MMU_P) {
|
||||
if ((entry & MMU_P) != 0U) {
|
||||
if (is_leaf(level, entry)) {
|
||||
if (phys == virt) {
|
||||
/* Identity mappings */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ const struct device *z_impl_device_get_binding(const char *name)
|
|||
/* A null string identifies no device. So does an empty
|
||||
* string.
|
||||
*/
|
||||
if ((name == NULL) || (*name == 0U)) {
|
||||
if ((name == NULL) || (name[0] == '\0')) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue