2018-08-30 22:37:51

by Igor Stoppa

[permalink] [raw]
Subject: [PATCH 01/23] infiniband: nes: add unlikely() to assert()

Typically the assert is expected to not fail.

Signed-off-by: Igor Stoppa <[email protected]>
Cc: Chien Tung <[email protected]>
Cc: Roland Dreier <[email protected]>
Cc: Faisal Latif <[email protected]>
Cc: Doug Ledford <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
---
drivers/infiniband/hw/nes/nes.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
index bedaa02749fb..d2d0098f38e0 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
@@ -151,7 +151,7 @@ do { \

#define assert(expr) \
do { \
- if (!(expr)) { \
+ if (unlikely(!(expr))) { \
printk(KERN_ERR PFX "Assertion failed! %s, %s, %s, line %d\n", \
#expr, __FILE__, __func__, __LINE__); \
} \
--
2.17.1



2018-08-31 14:09:10

by Doug Ledford

[permalink] [raw]
Subject: Re: [PATCH 01/23] infiniband: nes: add unlikely() to assert()

On Fri, 2018-08-31 at 01:34 +0300, Igor Stoppa wrote:
> Typically the assert is expected to not fail.
>
> Signed-off-by: Igor Stoppa <[email protected]>
> Cc: Chien Tung <[email protected]>
> Cc: Roland Dreier <[email protected]>
> Cc: Faisal Latif <[email protected]>
> Cc: Doug Ledford <[email protected]>
> Cc: Jason Gunthorpe <[email protected]>

Acked-by: Doug Ledford <[email protected]>

> ---
> drivers/infiniband/hw/nes/nes.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
> index bedaa02749fb..d2d0098f38e0 100644
> --- a/drivers/infiniband/hw/nes/nes.h
> +++ b/drivers/infiniband/hw/nes/nes.h
> @@ -151,7 +151,7 @@ do { \
>
> #define assert(expr) \
> do { \
> - if (!(expr)) { \
> + if (unlikely(!(expr))) { \
> printk(KERN_ERR PFX "Assertion failed! %s, %s, %s, line %d\n", \
> #expr, __FILE__, __func__, __LINE__); \
> } \

--
Doug Ledford <[email protected]>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD


Attachments:
signature.asc (849.00 B)
This is a digitally signed message part