]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net/mlx5: HWS, changed E2BIG error to a negative return code
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Mon, 16 Sep 2024 11:13:39 +0000 (14:13 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 25 Sep 2024 20:15:45 +0000 (13:15 -0700)
Fixed all the 'E2BIG' returns in error flow of functions to
the negative '-E2BIG' as we are using negative error codes
everywhere in HWS code.

This also fixes the following smatch warnings:
"warn: was negative '-E2BIG' intended?"

Fixes: 74a778b4a63f ("net/mlx5: HWS, added definers handling")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/f8c77688-7d83-4937-baba-ac844dfe2e0b@stanley.mountain/
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_bwc_complex.c
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_definer.c
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_matcher.c

index bb563f50ef09a246c1c6e2f80e7cbcd6df4abf2b..601fad5fc54a39fd3540c2e6872c68fcccedbc1d 100644 (file)
@@ -33,7 +33,7 @@ bool mlx5hws_bwc_match_params_is_complex(struct mlx5hws_context *ctx,
                 * and let the usual match creation path handle it,
                 * both for good and bad flows.
                 */
-               if (ret == E2BIG) {
+               if (ret == -E2BIG) {
                        is_complex = true;
                        mlx5hws_dbg(ctx, "Matcher definer layout: need complex matcher\n");
                } else {
index 3bdb5c90efffa536940bbc66c75c6bba51e2f07d..d566d2ddf42435d2f0a93ef0cfd7017bbe69b0c3 100644 (file)
@@ -1845,7 +1845,7 @@ hws_definer_find_best_match_fit(struct mlx5hws_context *ctx,
                return 0;
        }
 
-       return E2BIG;
+       return -E2BIG;
 }
 
 static void
@@ -1931,7 +1931,7 @@ mlx5hws_definer_calc_layout(struct mlx5hws_context *ctx,
        /* Find the match definer layout for header layout match union */
        ret = hws_definer_find_best_match_fit(ctx, match_definer, match_hl);
        if (ret) {
-               if (ret == E2BIG)
+               if (ret == -E2BIG)
                        mlx5hws_dbg(ctx,
                                    "Failed to create match definer from header layout - E2BIG\n");
                else
index 33d2b31e4b4645bbd9c3dd8baa64e0a518f07909..61a1155d4b4fdb26674229a8c045e853718ea262 100644 (file)
@@ -675,7 +675,7 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher *matcher)
        if (!(matcher->flags & MLX5HWS_MATCHER_FLAGS_COLLISION)) {
                ret = mlx5hws_definer_mt_init(ctx, matcher->mt);
                if (ret) {
-                       if (ret == E2BIG)
+                       if (ret == -E2BIG)
                                mlx5hws_err(ctx, "Failed to set matcher templates with match definers\n");
                        return ret;
                }