Skip to contentSkip to conversation

RDMA/core: Fix a WARN() message

PATCH Applied Dan Carpenter 4 participants 5 messages Feb 22, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/core: Fix a WARN() message

The first parameter of WARN_ONCE() is a condition, then following parameters are the message. In this case, we left out the condition so it will just print the ops->type string.

Fixes 3856ec4b93c9 ("RDMA/core: Add RDMA_NLDEV_CMD_NEWLINK/DELLINK support")
---
 drivers/infiniband/core/nldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +1 -1
index 5e94dc87f04f..660a192a44a3 100644
@@ -1223,7 +1223,7 @@ void rdma_link_register(struct rdma_link_ops *ops)
 {
 	down_write(&link_ops_rwsem);
 	if (link_ops_get(ops->type)) {
-		WARN_ONCE("Duplicate rdma_link_ops! %s\n", ops->type);
+		WARN_ONCE(1, "Duplicate rdma_link_ops! %s\n", ops->type);
 		goto out;
 	}
 	list_add(&ops->list, &link_ops);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

The first parameter of WARN_ONCE() is a condition, then following parameters are the message. In this case, we left out the condition so it will just print the ops->type string.

Fixes 3856ec4b93c9 ("RDMA/core: Add RDMA_NLDEV_CMD_NEWLINK/DELLINK support")
Quoted 20 lines

---
drivers/infiniband/core/nldev.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +1 -1
index 5e94dc87f04f..660a192a44a3 100644
@@ -1223,7 +1223,7 @@ void rdma_link_register(struct rdma_link_ops *ops)
 {
   down_write(&link_ops_rwsem);
   if (link_ops_get(ops->type)) {
-        WARN_ONCE("Duplicate rdma_link_ops! %s\n", ops->type);
+        WARN_ONCE(1, "Duplicate rdma_link_ops! %s\n", ops->type);
       goto out;
   }
   list_add(&ops->list, &link_ops);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 15 lines · Dan Carpenter

The first parameter of WARN_ONCE() is a condition, then following parameters are the message. In this case, we left out the condition so it will just print the ops->type string.

Fixes 3856ec4b93c9 ("RDMA/core: Add RDMA_NLDEV_CMD_NEWLINK/DELLINK support")
---
 drivers/infiniband/core/nldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +0 -0
index 5e94dc87f04f..660a192a44a3 100644

drivers/infiniband/core/nldev.c void rdma_link_register(struct rdma_link_ops *ops) · line 1229

Quoted 8 lines
drivers/infiniband/core/nldev.c +1 -1
@@ -1223,7 +1223,7 @@ void rdma_link_register(struct rdma_link_ops *ops)
 {
 	down_write(&link_ops_rwsem);
 	if (link_ops_get(ops->type)) {
-		WARN_ONCE("Duplicate rdma_link_ops! %s\n", ops->type);
+		WARN_ONCE(1, "Duplicate rdma_link_ops! %s\n", ops->type);
 		goto out;
 	}
 	list_add(&ops->list, &link_ops);

Thanks!

#3 lore raw
In reply to Dan Carpenter
Quoted 15 lines · Dan Carpenter

The first parameter of WARN_ONCE() is a condition, then following parameters are the message. In this case, we left out the condition so it will just print the ops->type string.

Fixes 3856ec4b93c9 ("RDMA/core: Add RDMA_NLDEV_CMD_NEWLINK/DELLINK support")
 drivers/infiniband/core/nldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +1 -0
index 5e94dc87f04f..660a192a44a3 100644
+++ b/drivers/infiniband/core/nldev.c

drivers/infiniband/core/nldev.c void rdma_link_register(struct rdma_link_ops *ops) · line 1227

Quoted 6 lines
drivers/infiniband/core/nldev.c +1 -1
@@ -1223,7 +1223,7 @@ void rdma_link_register(struct rdma_link_ops *ops)
 {
 	down_write(&link_ops_rwsem);
 	if (link_ops_get(ops->type)) {
-		WARN_ONCE("Duplicate rdma_link_ops! %s\n", ops->type);
+		WARN_ONCE(1, "Duplicate rdma_link_ops! %s\n", ops->type);
 		goto out;

I think I prefer

	if (WARN_ON_ONCE(link_ops_get(ops->type)))
		goto out;

No need to belabor things

Applied to for-next with the change

Jason

#4 lore raw
In reply to Dan Carpenter
Quoted 25 lines · Jason Gunthorpe
Quoted 15 lines · Dan Carpenter

The first parameter of WARN_ONCE() is a condition, then following parameters are the message. In this case, we left out the condition so it will just print the ops->type string.

Fixes 3856ec4b93c9 ("RDMA/core: Add RDMA_NLDEV_CMD_NEWLINK/DELLINK support")
 drivers/infiniband/core/nldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +1 -0
index 5e94dc87f04f..660a192a44a3 100644
+++ b/drivers/infiniband/core/nldev.c

drivers/infiniband/core/nldev.c void rdma_link_register(struct rdma_link_ops *ops) · line 1227

Quoted 6 lines
drivers/infiniband/core/nldev.c +1 -1
@@ -1223,7 +1223,7 @@ void rdma_link_register(struct rdma_link_ops *ops)
 {
 	down_write(&link_ops_rwsem);
 	if (link_ops_get(ops->type)) {
-		WARN_ONCE("Duplicate rdma_link_ops! %s\n", ops->type);
+		WARN_ONCE(1, "Duplicate rdma_link_ops! %s\n", ops->type);
 		goto out;

I think I prefer

Quoted 7 lines
	if (WARN_ON_ONCE(link_ops_get(ops->type)))
		goto out;

No need to belabor things

Applied to for-next with the change

Thank you very much, sir! You are a gentleman and a scholar.

regards,
dan carpenter