Skip to content

Commit 3d840e0

Browse files
igor-stoppamstsirkin
authored andcommitted
virtio: add unlikely() to WARN_ON_ONCE()
The condition to test is unlikely() to be true. Add the hint. Signed-off-by: Igor Stoppa <[email protected]> Cc: "Michael S. Tsirkin" <[email protected]> Cc: Jason Wang <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent cd6c84d commit 3d840e0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/virtio/linux/kernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static inline void free_page(unsigned long addr)
127127
#define dev_err(dev, format, ...) fprintf (stderr, format, ## __VA_ARGS__)
128128
#define dev_warn(dev, format, ...) fprintf (stderr, format, ## __VA_ARGS__)
129129

130-
#define WARN_ON_ONCE(cond) ((cond) ? fprintf (stderr, "WARNING\n") : 0)
130+
#define WARN_ON_ONCE(cond) (unlikely(cond) ? fprintf (stderr, "WARNING\n") : 0)
131131

132132
#define min(x, y) ({ \
133133
typeof(x) _min1 = (x); \

0 commit comments

Comments
 (0)