All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] common/mlx5: fix probing return value when failing
@ 2022-01-17 17:49 Bing Zhao
  2022-01-26 15:27 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Bing Zhao @ 2022-01-17 17:49 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: dev, rasland, xuemingl, stable

While probing the device with unsupported class, the process should
fail because no appropriate driver was found. After traversing all
the drivers, an error value should be returned for the case.

In the previous implementation, zero value indicating probing success
was wrongly returned.

Fixes: ad435d320473 ("common/mlx5: add bus-agnostic layer")
Cc: xuemingl@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/common/mlx5/mlx5_common.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index 185db4d004..47a541f5ef 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -644,7 +644,7 @@ drivers_probe(struct mlx5_common_device *cdev, uint32_t user_classes)
 	struct mlx5_class_driver *driver;
 	uint32_t enabled_classes = 0;
 	bool already_loaded;
-	int ret;
+	int ret = -EINVAL;
 
 	TAILQ_FOREACH(driver, &drivers_list, next) {
 		if ((driver->drv_class & user_classes) == 0)
@@ -666,8 +666,10 @@ drivers_probe(struct mlx5_common_device *cdev, uint32_t user_classes)
 		}
 		enabled_classes |= driver->drv_class;
 	}
-	cdev->classes_loaded |= enabled_classes;
-	return 0;
+	if (!ret) {
+		cdev->classes_loaded |= enabled_classes;
+		return 0;
+	}
 probe_err:
 	/*
 	 * Need to remove only drivers which were not probed before this probe
-- 
2.27.0


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

* RE: [PATCH] common/mlx5: fix probing return value when failing
  2022-01-17 17:49 [PATCH] common/mlx5: fix probing return value when failing Bing Zhao
@ 2022-01-26 15:27 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2022-01-26 15:27 UTC (permalink / raw)
  To: Bing Zhao, Slava Ovsiienko, Matan Azrad; +Cc: dev, Xueming(Steven) Li, stable

Hi,

> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Monday, January 17, 2022 7:49 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> Xueming(Steven) Li <xuemingl@nvidia.com>; stable@dpdk.org
> Subject: [PATCH] common/mlx5: fix probing return value when failing
> 
> While probing the device with unsupported class, the process should
> fail because no appropriate driver was found. After traversing all
> the drivers, an error value should be returned for the case.
> 
> In the previous implementation, zero value indicating probing success
> was wrongly returned.
> 
> Fixes: ad435d320473 ("common/mlx5: add bus-agnostic layer")
> Cc: xuemingl@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2022-01-26 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 17:49 [PATCH] common/mlx5: fix probing return value when failing Bing Zhao
2022-01-26 15:27 ` Raslan Darawsheh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.