xen: Rework WARN_ON() to return whether a warning was triggered
authorJulien Grall <jgrall@amazon.com>
Fri, 18 Dec 2020 13:30:54 +0000 (13:30 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Mon, 21 Dec 2020 22:39:38 +0000 (14:39 -0800)
commit8c8938dcc1bd37dd61f705410053e08804ca2b55
treebe434287442ce633f7adf6f45f139c5dbd7665a1
parentffa9d2999722a404d3a4381b0249d191de134d33
xen: Rework WARN_ON() to return whether a warning was triggered

So far, our implementation of WARN_ON() cannot be used in the following
situation:

if ( WARN_ON() )
    ...

This is because WARN_ON() doesn't return whether a warning has been
triggered. Such construciton can be handy if you want to print more
information and also dump the stack trace.

Therefore, rework the WARN_ON() implementation to return whether a
warning was triggered. The idea was borrowed from Linux

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/lib.h