From 984077d35ce4870b6d8f844f994d668c1199b46a Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg@hobbykeller.org>
Date: Fri, 10 Mar 2017 16:10:01 +0100
Subject: [PATCH] cpu: x86: eliminate cppcheck warnings

---
 cpu/x86/x86_memory.c | 2 ++
 cpu/x86/x86_pci.c    | 2 +-
 cpu/x86/x86_pit.c    | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cpu/x86/x86_memory.c b/cpu/x86/x86_memory.c
index d2a4117d52..a1a2b6b190 100644
--- a/cpu/x86/x86_memory.c
+++ b/cpu/x86/x86_memory.c
@@ -76,6 +76,8 @@ void x86_init_gdt(void)
             .limit_16_19_and_flags = 0,
             .base_24_31            = 0,
         },
+        /* cppcheck-suppress duplicateExpression
+         * it's for consistent look & feel */
         [0x0008 / 8] = {
             .limit_0_15            = 0xFFFF,
             .base_0_15             = 0,
diff --git a/cpu/x86/x86_pci.c b/cpu/x86/x86_pci.c
index 706af0ba93..9eabdf7790 100644
--- a/cpu/x86/x86_pci.c
+++ b/cpu/x86/x86_pci.c
@@ -181,7 +181,7 @@ static void pci_setup_ios(struct x86_known_pci_device *dev)
                 printf("    BAR %u: memory, physical = 0x%08x-0x%08x, virtual = 0x%08x-0x%08x\n",
                        bar_num,
                        physical_start, physical_start + length - 1,
-                       (unsigned) ptr, (uintptr_t) ptr + length - 1);
+                       (unsigned) ptr, (unsigned) ((uintptr_t) ptr + length - 1));
             }
         }
     }
diff --git a/cpu/x86/x86_pit.c b/cpu/x86/x86_pit.c
index dfa77b578f..32984dd47a 100644
--- a/cpu/x86/x86_pit.c
+++ b/cpu/x86/x86_pit.c
@@ -55,7 +55,7 @@ void x86_pit_set2(unsigned channel, unsigned mode, uint16_t max)
 {
     unsigned old_flags = irq_disable();
     outb(PIT_COMMAND_PORT, ((channel - 1) << 6) | mode | PIT_ACCESS_MODE_LO_HI);
-    outb(PIT_CHANNEL_0_PORT + channel - 1, max && 0xff);
+    outb(PIT_CHANNEL_0_PORT + channel - 1, max & 0xff);
     outb(PIT_CHANNEL_0_PORT + channel - 1, max >> 8);
     irq_restore(old_flags);
 }
-- 
GitLab