trivial: Fix compiler warnings

- Declare unused variables
- Move variable initialization to prevent uninitialized use
- Correctly store bitwise operation result
- Fixup memset calls to use correct size
- Add missing return statement to functions
- Conditionally define functions that are used conditionally
diff --git a/libsel4allocman/src/cspace/two_level.c b/libsel4allocman/src/cspace/two_level.c
index 9420fdf..e66b7cb 100644
--- a/libsel4allocman/src/cspace/two_level.c
+++ b/libsel4allocman/src/cspace/two_level.c
@@ -215,7 +215,7 @@
     cspacepath_t path;
     cspace_single_level_destroy(alloc, &cspace->second_levels[index]->second_level);
     if (cspace->second_levels[index]->cookie_valid) {
-        int error = seL4_CNode_Delete(cspace->config.cnode, index,
+        int UNUSED error = seL4_CNode_Delete(cspace->config.cnode, index,
                                       seL4_WordBits - cspace->config.level_two_bits);
         assert(error == seL4_NoError);
         allocman_utspace_free(alloc, cspace->second_levels[index]->cookie, cspace->config.level_two_bits + seL4_SlotBits);
diff --git a/libsel4platsupport/src/irq.c b/libsel4platsupport/src/irq.c
index f7bbc73..27d09ef 100644
--- a/libsel4platsupport/src/irq.c
+++ b/libsel4platsupport/src/irq.c
@@ -352,6 +352,10 @@
                                         ps_malloc_ops_t *malloc_ops, irq_iface_type_t iface_type)
 {
     int err = 0;
+    /* Figure out how many bitfields we need to keep track of the allocation status of the IDs */
+    size_t bits_in_seL4_Word = sizeof(seL4_Word) * CHAR_BIT;
+    size_t num_irq_bitfields = ALIGN_UP(irq_config.max_irq_ids, bits_in_seL4_Word) / sizeof(seL4_Word);
+    size_t num_ntfn_bitfields = ALIGN_UP(irq_config.max_ntfn_ids, bits_in_seL4_Word) / sizeof(seL4_Word);
 
     irq_cookie_t *cookie = 0;
     err = ps_calloc(malloc_ops, 1, sizeof(irq_cookie_t), (void **) &cookie);
@@ -379,13 +383,9 @@
         goto error;
     }
     for (int i = 0; i < irq_config.max_ntfn_ids; i++) {
-        memset(cookie->ntfn_table[i].bound_irqs, UNPAIRED_ID, MAX_INTERRUPTS_TO_NOTIFICATIONS);
+        memset(cookie->ntfn_table[i].bound_irqs, UNPAIRED_ID, sizeof(irq_id_t) * MAX_INTERRUPTS_TO_NOTIFICATIONS);
     }
 
-    /* Figure out how many bitfields we need to keep track of the allocation status of the IDs */
-    size_t bits_in_seL4_Word = sizeof(seL4_Word) * CHAR_BIT;
-    size_t num_irq_bitfields = ALIGN_UP(irq_config.max_irq_ids, bits_in_seL4_Word) / sizeof(seL4_Word);
-    size_t num_ntfn_bitfields = ALIGN_UP(irq_config.max_ntfn_ids, bits_in_seL4_Word) / sizeof(seL4_Word);
     err = ps_calloc(malloc_ops, 1, num_irq_bitfields * sizeof(seL4_Word),
                     (void **) & (cookie->allocated_irq_bitfields));
     if (err) {
@@ -711,7 +711,7 @@
     /* Zero out the entire entry */
     memset(ntfn_entry, 0, sizeof(ntfn_entry_t));
     /* Reset the bound_irqs array for the entry */
-    memset(ntfn_entry->bound_irqs, UNPAIRED_ID, MAX_INTERRUPTS_TO_NOTIFICATIONS);
+    memset(ntfn_entry->bound_irqs, UNPAIRED_ID, sizeof(irq_id_t) * MAX_INTERRUPTS_TO_NOTIFICATIONS);
 
     irq_cookie->num_allocated_ntfns--;
     unfill_bit_in_bitfield(irq_cookie->allocated_ntfn_bitfields, ntfn_id);
@@ -843,7 +843,7 @@
         bool callback_called = perform_callback(irq_cookie, paired_irq_id, bit_index);
         if (callback_called && ntfn_entry->pending_bitfield & BIT(bit_index)) {
             /* Unset the bit, we've performed the callback for that interrupt */
-            ntfn_entry->pending_bitfield & ~BIT(bit_index);
+            ntfn_entry->pending_bitfield &= ~BIT(bit_index);
         }
         unchecked_bits &= ~BIT(bit_index);
     }
diff --git a/libsel4platsupport/src/timer.c b/libsel4platsupport/src/timer.c
index a25edc4..d46d189 100644
--- a/libsel4platsupport/src/timer.c
+++ b/libsel4platsupport/src/timer.c
@@ -287,6 +287,9 @@
                 break;
             case PS_NONE:
                 ZF_LOGE("Invalid irq type");
+                break;
+            default:
+                ZF_LOGE("Unsupported irq type");
             }
         }
     }
diff --git a/libsel4vspace/src/arch/arm/mapping.c b/libsel4vspace/src/arch/arm/mapping.c
index fe9b504..67f2aa0 100644
--- a/libsel4vspace/src/arch/arm/mapping.c
+++ b/libsel4vspace/src/arch/arm/mapping.c
@@ -13,12 +13,12 @@
 #include <autoconf.h>
 #include <vspace/mapping.h>
 
+#ifdef CONFIG_ARM_SMMU
 static seL4_Error vspace_map_io(seL4_CPtr cap, seL4_CPtr iospace_root, seL4_Word vaddr, UNUSED seL4_Word attr)
 {
-#ifdef CONFIG_ARM_SMMU
     return seL4_ARM_IOPageTable_Map(cap, iospace_root, vaddr);
-#endif
 }
+#endif
 
 int vspace_get_iospace_map_obj(UNUSED seL4_Word failed_bits, vspace_map_obj_t *obj)
 {
@@ -29,6 +29,6 @@
     obj->size_bits = seL4_IOPageTableBits;
     obj->type = seL4_ARM_IOPageTableObject;
     obj->map_fn = vspace_map_io;
-    return 0;
 #endif
+    return 0;
 }