Skip to contentSkip to conversation

xen: Replace ASSERT(0) with ASSERT_UNREACHABLE()

PATCH In review Andrew Cooper 4 participants 4 messages Jun 21, 2017 – Jun 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: Replace ASSERT(0) with ASSERT_UNREACHABLE()

No functional change, but the result is more informative both in the code and error messages if the assertions do get hit.

---
CC: Jan Beulich <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

---
 xen/arch/arm/mm.c                        | 4 ++--
 xen/common/tmem_xen.c                    | 4 ++--
 xen/drivers/passthrough/amd/iommu_acpi.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
xen/arch/arm/mm.c +2 -2
index 341bacf..5475557 100644
@@ -1154,7 +1154,7 @@ void arch_dump_shared_mem_info(void)
 
 int donate_page(struct domain *d, struct page_info *page, unsigned int memflags)
 {
-    ASSERT(0);
+    ASSERT_UNREACHABLE();
     return -ENOSYS;
 }
 
@@ -1166,7 +1166,7 @@ int steal_page(
 
 int page_is_ram_type(unsigned long mfn, unsigned long mem_type)
 {
-    ASSERT(0);
+    ASSERT_UNREACHABLE();
     return 0;
 }
 
xen/common/tmem_xen.c +2 -2
index 06ce3ef..725ae93 100644
@@ -34,14 +34,14 @@ static DEFINE_PER_CPU_READ_MOSTLY(void *, scratch_page);
 static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn,
                                  struct page_info **pcli_pfp, bool_t cli_write)
 {
-    ASSERT(0);
+    ASSERT_UNREACHABLE();
     return NULL;
 }
 
 static inline void cli_put_page(void *cli_va, struct page_info *cli_pfp,
                                 unsigned long cli_mfn, bool_t mark_dirty)
 {
-    ASSERT(0);
+    ASSERT_UNREACHABLE();
 }
 #else
 #include <asm/p2m.h>
xen/drivers/passthrough/amd/iommu_acpi.c +1 -1
index d8a9205..f4c7206 100644
@@ -818,7 +818,7 @@ static u16 __init parse_ivhd_device_special(
             hpet_sbdf.init = HPET_IVHD;
             break;
         default:
-            ASSERT(0);
+            ASSERT_UNREACHABLE();
             break;
         }
         break;
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper

Hi Andrew,

Quoted 4 lines · Andrew Cooper

No functional change, but the result is more informative both in the code and error messages if the assertions do get hit.

For ARM bits:

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper

No functional change, but the result is more informative both in the code and error messages if the assertions do get hit.

---
CC: Jan Beulich <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel