Skip to content

Commit bb70913

Browse files
Jing Yangyangjgross1
authored andcommitted
drivers/xen/xenbus/xenbus_client.c: fix bugon.cocci warnings
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> Reviewed-by: SeongJae Park <sjpark@amazon.de> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/20210825062451.69998-1-deng.changcheng@zte.com.cn Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent b94e4b1 commit bb70913

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/xen/xenbus/xenbus_client.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,7 @@ static int __xenbus_map_ring(struct xenbus_device *dev,
542542
}
543543
}
544544

545-
if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, info->unmap, j))
546-
BUG();
545+
BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, info->unmap, j));
547546

548547
*leaked = false;
549548
for (i = 0; i < j; i++) {
@@ -581,8 +580,7 @@ static int xenbus_unmap_ring(struct xenbus_device *dev, grant_handle_t *handles,
581580
gnttab_set_unmap_op(&unmap[i], vaddrs[i],
582581
GNTMAP_host_map, handles[i]);
583582

584-
if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, i))
585-
BUG();
583+
BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, i));
586584

587585
err = GNTST_okay;
588586
for (i = 0; i < nr_handles; i++) {
@@ -778,8 +776,7 @@ static int xenbus_unmap_ring_pv(struct xenbus_device *dev, void *vaddr)
778776
unmap[i].handle = node->handles[i];
779777
}
780778

781-
if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, i))
782-
BUG();
779+
BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, i));
783780

784781
err = GNTST_okay;
785782
leaked = false;

0 commit comments

Comments
 (0)