Skip to content

Commit

Permalink
virtio: add unlikely() to WARN_ON_ONCE()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
igor-stoppa authored and mstsirkin committed May 27, 2019
1 parent cd6c84d commit 3d840e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/virtio/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down

0 comments on commit 3d840e0

Please sign in to comment.