virtio: add unlikely() to WARN_ON_ONCE()
authorIgor Stoppa <igor.stoppa@gmail.com>
Fri, 7 Sep 2018 17:48:02 +0000 (20:48 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 27 May 2019 15:08:22 +0000 (11:08 -0400)
The condition to test is unlikely() to be true. Add the hint.

Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Virtualization@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
tools/virtio/linux/kernel.h

index 7ef45a4..6683b4a 100644 (file)
@@ -127,7 +127,7 @@ static inline void free_page(unsigned long addr)
 #define dev_err(dev, format, ...) fprintf (stderr, format, ## __VA_ARGS__)
 #define dev_warn(dev, format, ...) fprintf (stderr, format, ## __VA_ARGS__)
 
-#define WARN_ON_ONCE(cond) ((cond) ? fprintf (stderr, "WARNING\n") : 0)
+#define WARN_ON_ONCE(cond) (unlikely(cond) ? fprintf (stderr, "WARNING\n") : 0)
 
 #define min(x, y) ({                           \
        typeof(x) _min1 = (x);                  \