* [PATCH] net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources
@ 2021-12-22 6:54 Miaoqian Lin
2021-12-22 19:10 ` Saeed Mahameed
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2021-12-22 6:54 UTC (permalink / raw)
Cc: linmq006, Saeed Mahameed, Leon Romanovsky, David S. Miller,
Jakub Kicinski, Yevgeny Kliteynik, Muhammad Sammar, Alex Vesker,
Erez Shitrit, Mark Bloch, netdev, linux-rdma, linux-kernel
The mlx5_get_uars_page() function returns error pointers.
Using IS_ERR() to check the return value to fix this.
Fixes: 4ec9e7b02697("net/mlx5: DR, Expose steering domain functionality")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
index 8cbd36c82b3b..f6e6d9209766 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
@@ -2,6 +2,7 @@
/* Copyright (c) 2019 Mellanox Technologies. */
#include <linux/mlx5/eswitch.h>
+#include <linux/err.h>
#include "dr_types.h"
#define DR_DOMAIN_SW_STEERING_SUPPORTED(dmn, dmn_type) \
@@ -72,9 +73,9 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn)
}
dmn->uar = mlx5_get_uars_page(dmn->mdev);
- if (!dmn->uar) {
+ if (IS_ERR(dmn->uar)) {
mlx5dr_err(dmn, "Couldn't allocate UAR\n");
- ret = -ENOMEM;
+ ret = PTR_ERR(dmn->uar);
goto clean_pd;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources
2021-12-22 6:54 [PATCH] net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources Miaoqian Lin
@ 2021-12-22 19:10 ` Saeed Mahameed
0 siblings, 0 replies; 2+ messages in thread
From: Saeed Mahameed @ 2021-12-22 19:10 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Saeed Mahameed, Leon Romanovsky, David S. Miller, Jakub Kicinski,
Yevgeny Kliteynik, Muhammad Sammar, Alex Vesker, Erez Shitrit,
Mark Bloch, netdev, linux-rdma, linux-kernel
On Wed, 2021-12-22 at 06:54 +0000, Miaoqian Lin wrote:
> The mlx5_get_uars_page() function returns error pointers.
> Using IS_ERR() to check the return value to fix this.
>
> Fixes: 4ec9e7b02697("net/mlx5: DR, Expose steering domain
> functionality")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Applied to net-mlx5.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-22 19:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-22 6:54 [PATCH] net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources Miaoqian Lin
2021-12-22 19:10 ` Saeed Mahameed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox