]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5: FWTrace, cancel work on alloc pd error flow
authorSaeed Mahameed <saeedm@nvidia.com>
Wed, 18 Aug 2021 20:09:26 +0000 (13:09 -0700)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 7 Sep 2021 21:16:52 +0000 (14:16 -0700)
Handle error flow on mlx5_core_alloc_pd() failure,
read_fw_strings_work must be canceled.

Fixes: 3649e5094c74 ("net/mlx5: FW tracer, events handling")
Reported-by: Pavel Machek (CIP) <pavel@denx.de>
Suggested-by: Pavel Machek (CIP) <pavel@denx.de>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c

index 3f8a98093f8cb79606698247da2ad4f2147f809a..f9cf9fb31547973e41808db83ce27500052f0758 100644 (file)
@@ -1007,7 +1007,7 @@ int mlx5_fw_tracer_init(struct mlx5_fw_tracer *tracer)
        err = mlx5_core_alloc_pd(dev, &tracer->buff.pdn);
        if (err) {
                mlx5_core_warn(dev, "FWTracer: Failed to allocate PD %d\n", err);
-               return err;
+               goto err_cancel_work;
        }
 
        err = mlx5_fw_tracer_create_mkey(tracer);
@@ -1031,6 +1031,7 @@ err_notifier_unregister:
        mlx5_core_destroy_mkey(dev, &tracer->buff.mkey);
 err_dealloc_pd:
        mlx5_core_dealloc_pd(dev, tracer->buff.pdn);
+err_cancel_work:
        cancel_work_sync(&tracer->read_fw_strings_work);
        return err;
 }