[PATCH linux-next] arch/ia64/kernel/module.c: fix bugon.cocci warnings

From: CGEL
Date: Sun Aug 22 2021 - 21:51:24 EST


From: Jing Yangyang <jing.yangyang@xxxxxxxxxx>

Use BUG_ON instead of a if condition followed by BUG.

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

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Jing Yangyang <jing.yangyang@xxxxxxxxxx>
---
arch/ia64/kernel/module.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 2cba53c..f199378 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -560,8 +560,7 @@ struct plt_entry {
while (plt->bundle[0][0]) {
if (plt_target(plt) == target_ip)
goto found;
- if (++plt >= plt_end)
- BUG();
+ BUG_ON(++plt >= plt_end);
}
*plt = ia64_plt_template;
if (!patch_plt(mod, plt, target_ip, target_gp)) {
@@ -605,8 +604,7 @@ struct plt_entry {
while (fdesc->ip) {
if (fdesc->ip == value)
return (uint64_t)fdesc;
- if ((uint64_t) ++fdesc >= mod->arch.opd->sh_addr + mod->arch.opd->sh_size)
- BUG();
+ BUG_ON((uint64_t) ++fdesc >= mod->arch.opd->sh_addr + mod->arch.opd->sh_size);
}

/* Create new one */
--
1.8.3.1