kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: Fix a WARN() message
@ 2019-02-22  6:29 Dan Carpenter
  2019-02-22  9:47 ` Majd Dibbiny
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-02-22  6:29 UTC (permalink / raw)
  To: kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/infiniband/core/nldev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 5e94dc87f04f..660a192a44a3 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix a WARN() message
  2019-02-22  6:29 [PATCH] RDMA/core: Fix a WARN() message Dan Carpenter
@ 2019-02-22  9:47 ` Majd Dibbiny
  2019-02-22 15:25 ` Steve Wise
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Majd Dibbiny @ 2019-02-22  9:47 UTC (permalink / raw)
  To: kernel-janitors


> On Feb 22, 2019, at 8:29 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> ---
> drivers/infiniband/core/nldev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> index 5e94dc87f04f..660a192a44a3 100644
> --- a/drivers/infiniband/core/nldev.c
> +++ b/drivers/infiniband/core/nldev.c
> @@ -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);
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix a WARN() message
  2019-02-22  6:29 [PATCH] RDMA/core: Fix a WARN() message Dan Carpenter
  2019-02-22  9:47 ` Majd Dibbiny
@ 2019-02-22 15:25 ` Steve Wise
  2019-02-22 18:56 ` Jason Gunthorpe
  2019-02-22 19:18 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2019-02-22 15:25 UTC (permalink / raw)
  To: kernel-janitors


On 2/22/2019 12:29 AM, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/infiniband/core/nldev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> index 5e94dc87f04f..660a192a44a3 100644
> --- a/drivers/infiniband/core/nldev.c
> +++ b/drivers/infiniband/core/nldev.c
> @@ -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);


Reviewed-by: Steve Wise <swise@opengridcomputing.com>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix a WARN() message
  2019-02-22  6:29 [PATCH] RDMA/core: Fix a WARN() message Dan Carpenter
  2019-02-22  9:47 ` Majd Dibbiny
  2019-02-22 15:25 ` Steve Wise
@ 2019-02-22 18:56 ` Jason Gunthorpe
  2019-02-22 19:18 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2019-02-22 18:56 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Feb 22, 2019 at 09:29:02AM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
>  drivers/infiniband/core/nldev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> index 5e94dc87f04f..660a192a44a3 100644
> +++ b/drivers/infiniband/core/nldev.c
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix a WARN() message
  2019-02-22  6:29 [PATCH] RDMA/core: Fix a WARN() message Dan Carpenter
                   ` (2 preceding siblings ...)
  2019-02-22 18:56 ` Jason Gunthorpe
@ 2019-02-22 19:18 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-02-22 19:18 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Feb 22, 2019 at 11:56:05AM -0700, Jason Gunthorpe wrote:
> On Fri, Feb 22, 2019 at 09:29:02AM +0300, Dan Carpenter wrote:
> > 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")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> > Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> >  drivers/infiniband/core/nldev.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> > index 5e94dc87f04f..660a192a44a3 100644
> > +++ b/drivers/infiniband/core/nldev.c
> > @@ -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
> 

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

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-22 19:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22  6:29 [PATCH] RDMA/core: Fix a WARN() message Dan Carpenter
2019-02-22  9:47 ` Majd Dibbiny
2019-02-22 15:25 ` Steve Wise
2019-02-22 18:56 ` Jason Gunthorpe
2019-02-22 19:18 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).