Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: erofs: unzip_vle_lz4.c,utils.c: rectify BUG_ONs

remove all redundant BUG_ONs, and turn the rest
useful usages to DBG_BUGONs.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gao Xiang and committed by
Greg Kroah-Hartman
b8e076a6 70b17991

+7 -7
+1 -1
drivers/staging/erofs/unzip_vle_lz4.c
··· 79 79 if (compressed_pages[j] != page) 80 80 continue; 81 81 82 - BUG_ON(mirrored[j]); 82 + DBG_BUGON(mirrored[j]); 83 83 memcpy(percpu_data + j * PAGE_SIZE, dst, PAGE_SIZE); 84 84 mirrored[j] = true; 85 85 break;
+6 -6
drivers/staging/erofs/utils.c
··· 23 23 list_del(&page->lru); 24 24 } else { 25 25 page = alloc_pages(gfp | __GFP_NOFAIL, 0); 26 - 27 - BUG_ON(page == NULL); 28 - BUG_ON(page->mapping != NULL); 29 26 } 30 27 return page; 31 28 } ··· 55 58 /* decrease refcount added by erofs_workgroup_put */ 56 59 if (unlikely(oldcount == 1)) 57 60 atomic_long_dec(&erofs_global_shrink_cnt); 58 - BUG_ON(index != grp->index); 61 + DBG_BUGON(index != grp->index); 59 62 } 60 63 rcu_read_unlock(); 61 64 return grp; ··· 68 71 struct erofs_sb_info *sbi; 69 72 int err; 70 73 71 - /* grp->refcount should not < 1 */ 72 - BUG_ON(!atomic_read(&grp->refcount)); 74 + /* grp shouldn't be broken or used before */ 75 + if (unlikely(atomic_read(&grp->refcount) != 1)) { 76 + DBG_BUGON(1); 77 + return -EINVAL; 78 + } 73 79 74 80 err = radix_tree_preload(GFP_NOFS); 75 81 if (err)