Rely on a local flag rather than dereference a bus object.
This will help next commits.

Signed-off-by: David Marchand <david.march...@redhat.com>
---
 drivers/common/mlx5/linux/mlx5_common_auxiliary.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c 
b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
index 6584aeb18e..a182a8bdde 100644
--- a/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
+++ b/drivers/common/mlx5/linux/mlx5_common_auxiliary.c
@@ -179,14 +179,20 @@ static struct rte_auxiliary_driver mlx5_auxiliary_driver 
= {
        .dma_unmap = mlx5_common_auxiliary_dma_unmap,
 };
 
+static bool mlx5_common_auxiliary_initialized;
+
 void mlx5_common_auxiliary_init(void)
 {
-       if (mlx5_auxiliary_driver.bus == NULL)
+       if (!mlx5_common_auxiliary_initialized) {
                rte_auxiliary_register(&mlx5_auxiliary_driver);
+               mlx5_common_auxiliary_initialized = true;
+       }
 }
 
 RTE_FINI(mlx5_common_auxiliary_driver_finish)
 {
-       if (mlx5_auxiliary_driver.bus != NULL)
+       if (mlx5_common_auxiliary_initialized) {
                rte_auxiliary_unregister(&mlx5_auxiliary_driver);
+               mlx5_common_auxiliary_initialized = false;
+       }
 }
-- 
2.36.1

Reply via email to