Skip to contentSkip to conversation

xen/arm: use BUG_ON

PATCH In review Himangi Saraogi 2 participants 3 messages Jul 8, 2014 – Jul 9, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: use BUG_ON

Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:

// <smpl>
@@ identifier x; @@
-if (x) BUG();
+BUG_ON(x);
// </smpl>

---
 arch/arm/xen/enlighten.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +2 -4
index 1e63243..98544c5 100644
@@ -181,8 +181,7 @@ static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
 	struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
 	int rc;
 	rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
-	if (rc)
-		BUG();
+	BUG_ON(rc);
 }
 
 static void xen_power_off(void)
@@ -190,8 +189,7 @@ static void xen_power_off(void)
 	struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
 	int rc;
 	rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
-	if (rc)
-		BUG();
+	BUG_ON(rc);
 }
 
 static int xen_cpu_notification(struct notifier_block *self,
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Himangi Saraogi

Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:

// <smpl>
@@ identifier x; @@

(quoted diff) +1 -1
-if (x) BUG();
+BUG_ON(x);

// </smpl>

Quoted 30 lines
 arch/arm/xen/enlighten.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +2 -4
index 1e63243..98544c5 100644
@@ -181,8 +181,7 @@ static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
 	struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
 	int rc;
 	rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
-	if (rc)
-		BUG();
+	BUG_ON(rc);
 }
 
 static void xen_power_off(void)
@@ -190,8 +189,7 @@ static void xen_power_off(void)
 	struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
 	int rc;
 	rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
-	if (rc)
-		BUG();
+	BUG_ON(rc);
 }
 
 static int xen_cpu_notification(struct notifier_block *self,
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#2 lore raw
In reply to Himangi Saraogi
Quoted 11 lines · Himangi Saraogi

Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:

// <smpl>
@@ identifier x; @@

(quoted diff) +1 -1
-if (x) BUG();
+BUG_ON(x);

// </smpl>

Quoted 30 lines
 arch/arm/xen/enlighten.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/xen/enlighten.c +2 -4
index 1e63243..98544c5 100644
@@ -181,8 +181,7 @@ static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
 	struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
 	int rc;
 	rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
-	if (rc)
-		BUG();
+	BUG_ON(rc);
 }
 
 static void xen_power_off(void)
@@ -190,8 +189,7 @@ static void xen_power_off(void)
 	struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
 	int rc;
 	rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
-	if (rc)
-		BUG();
+	BUG_ON(rc);
 }
 
 static int xen_cpu_notification(struct notifier_block *self,
Signature · 1 line
1.9.1