summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-05-19 02:08:52 (GMT)
committerSimon Glass <sjg@chromium.org>2017-06-01 13:03:06 (GMT)
commitfd7029029f5fd23990fb18c1049167fdcf95104d (patch)
treee400ef08913bf5f0fe5b711364b824fe20d80ac5 /include/linux
parent01b120b6395d5be6fc0fb408df8bf8849c2c47b5 (diff)
downloadu-boot-fsl-qoriq-fd7029029f5fd23990fb18c1049167fdcf95104d.tar.xz
Update WARN_ON() to return a value
In linux v4.9 this returns a value. This saves checking the warning condition twice in some code. Update the U-Boot version to do this also. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compat.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
index a43e4d6..03f9bef 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -106,8 +106,12 @@ static inline void kmem_cache_destroy(struct kmem_cache *cachep)
#define BUG_ON(condition) do { if (condition) BUG(); } while(0)
#endif /* BUG */
-#define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \
- , __FILE__, __LINE__); }
+#define WARN_ON(condition) ({ \
+ int __ret_warn_on = !!(condition); \
+ if (unlikely(__ret_warn_on)) \
+ printf("WARNING in %s line %d\n", __FILE__, __LINE__);; \
+ unlikely(__ret_warn_on); \
+})
#define PAGE_SIZE 4096