treewide: convert assert() to BUG_ON()
We do not need multiple ways to do the same thing. Instead of
assert(), use BUG_ON() from Linux. The logic is opposite, but
Coccinelle is of great help for such a conversion. We could
simply convert assert(x) to BUG_ON(!x) for all expressions "x",
but I did a bit better job by converting assert(a == b) to
BUG_ON(a != b), etc.
The semantic patch I used is as follows:
// <smpl>
@@@@
-assert(0)
+BUG()
@@
expression a;
@@
-assert((a))
+assert(a)
@@
expression a;
@@
-assert(a == 0)
+BUG_ON(a)
@@
expression a;
@@
-assert(a == NULL)
+BUG_ON(a)
@@
expression a;
@@
-assert(a != 0)
+BUG_ON(!a)
@@
expression a;
@@
-assert(a != NULL)
+BUG_ON(!a)
@@
expression a, b;
@@
-assert(a == b)
+BUG_ON(a != b)
@@
expression a, b;
@@
-assert(a != b)
+BUG_ON(a == b)
@@
expression a, b;
@@
-assert(a < b)
+BUG_ON(a >= b)
@@
expression a, b;
@@
-assert(a <= b)
+BUG_ON(a > b)
@@
expression a;
@@
-assert(!a)
+BUG_ON(a)
@@
expression a;
@@
-assert(a)
+BUG_ON(!a)
// </smpl>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Do not convert test/ code]
Signed-off-by: Tom Rini <trini@konsulko.com>
70 files changed