mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH linux-next] arch/x86/xen/time.c: fix bugon.cocci warnings
@ 2021-08-23  2:13 CGEL
  2021-08-23  8:33 ` Juergen Gross
  0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-23  2:13 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: Juergen Gross, Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H . Peter Anvin, xen-devel, linux-kernel,
	Jing Yangyang, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

Use BUG_ON instead of a if condition followed by BUG.

Generated by: scripts/coccinelle/misc/bugon.cocci

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 arch/x86/xen/time.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index d9c945e..6e29b69 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -210,8 +210,7 @@ static int xen_timerop_set_next_event(unsigned long delta,
 {
 	WARN_ON(!clockevent_state_oneshot(evt));
 
-	if (HYPERVISOR_set_timer_op(get_abs_timeout(delta)) < 0)
-		BUG();
+	BUG_ON(HYPERVISOR_set_timer_op(get_abs_timeout(delta)) < 0);
 
 	/* We may have missed the deadline, but there's no real way of
 	   knowing for sure.  If the event was in the past, then we'll
@@ -241,11 +240,10 @@ static int xen_vcpuop_shutdown(struct clock_event_device *evt)
 {
 	int cpu = smp_processor_id();
 
-	if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, xen_vcpu_nr(cpu),
+	BUG_ON(HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, xen_vcpu_nr(cpu),
 			       NULL) ||
-	    HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu),
-			       NULL))
-		BUG();
+		HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu),
+			       NULL));
 
 	return 0;
 }
@@ -254,9 +252,8 @@ static int xen_vcpuop_set_oneshot(struct clock_event_device *evt)
 {
 	int cpu = smp_processor_id();
 
-	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu),
-			       NULL))
-		BUG();
+	BUG_ON(HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, xen_vcpu_nr(cpu),
+			       NULL));
 
 	return 0;
 }
@@ -373,9 +370,8 @@ void xen_timer_resume(void)
 		return;
 
 	for_each_online_cpu(cpu) {
-		if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
-				       xen_vcpu_nr(cpu), NULL))
-			BUG();
+		BUG_ON(HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
+				       xen_vcpu_nr(cpu), NULL));
 	}
 }
 
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-23  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  2:13 [PATCH linux-next] arch/x86/xen/time.c: fix bugon.cocci warnings CGEL
2021-08-23  8:33 ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®