diff --git a/kernel/module.c b/kernel/module.c
index 927d46cb8eb930fff0468730f91841676ddbfdc2..64bd61b2d3ad8687edaec8df867da9f16c0f248f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1018,8 +1018,7 @@ void __symbol_put(const char *symbol)
 	};
 
 	preempt_disable();
-	if (!find_symbol(&fsa))
-		BUG();
+	BUG_ON(!find_symbol(&fsa));
 	module_put(fsa.owner);
 	preempt_enable();
 }
@@ -4425,9 +4424,10 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
 			ret = fn(data, kallsyms_symbol_name(kallsyms, i),
 				 mod, kallsyms_symbol_value(sym));
 			if (ret != 0)
-				break;
+				goto out;
 		}
 	}
+out:
 	mutex_unlock(&module_mutex);
 	return ret;
 }