diff mbox series

[(mellanox,tree)] net/mlx5: delete dead code in mlx5_esw_unlock()

Message ID YpStOhUL4j7KBSqt@kili (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [(mellanox,tree)] net/mlx5: delete dead code in mlx5_esw_unlock() | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 3 maintainers not CCed: davem@davemloft.net kuba@kernel.org edumazet@google.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Dan Carpenter May 30, 2022, 11:40 a.m. UTC
Smatch complains about this function:

    drivers/net/ethernet/mellanox/mlx5/core/eswitch.c:2000 mlx5_esw_unlock()
    warn: inconsistent returns '&esw->mode_lock'.

Before commit ec2fa47d7b98 ("net/mlx5: Lag, use lag lock") there
used to be a matching mlx5_esw_lock() function and the lock and
unlock functions were symmetric.  But now we take the long
unconditionally and must unlock unconditionally as well.

As near as I can tell this is dead code and can just be deleted.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Saeed Mahameed May 31, 2022, 8:11 p.m. UTC | #1
On 30 May 14:40, Dan Carpenter wrote:

You can use [PATCH net-mlx5] for fixes and [PATCH net-next-mlx5] for
none-critical commits.

>Smatch complains about this function:
>
>    drivers/net/ethernet/mellanox/mlx5/core/eswitch.c:2000 mlx5_esw_unlock()
>    warn: inconsistent returns '&esw->mode_lock'.
>
>Before commit ec2fa47d7b98 ("net/mlx5: Lag, use lag lock") there
>used to be a matching mlx5_esw_lock() function and the lock and
>unlock functions were symmetric.  But now we take the long
                                                        ^ lock ? 
>unconditionally and must unlock unconditionally as well.
>
>As near as I can tell this is dead code and can just be deleted.
>
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Fixed up the typo and applied to net-next-mlx5.

Thanks,
Saeed.
Dan Carpenter June 1, 2022, 6:52 a.m. UTC | #2
On Tue, May 31, 2022 at 01:11:25PM -0700, Saeed Mahameed wrote:
> On 30 May 14:40, Dan Carpenter wrote:
> 
> You can use [PATCH net-mlx5] for fixes and [PATCH net-next-mlx5] for
> none-critical commits.
> 

Realistically, there is no way I'm going to remember that and there
isn't an automated way to look it up.

I try really hard to get the net tree stuff correct so when netdev is
on the CC list.  But putting the correct net tree in the subject line
is quite a huge headache and I quite often get it wrong.

> > Smatch complains about this function:
> > 
> >    drivers/net/ethernet/mellanox/mlx5/core/eswitch.c:2000 mlx5_esw_unlock()
> >    warn: inconsistent returns '&esw->mode_lock'.
> > 
> > Before commit ec2fa47d7b98 ("net/mlx5: Lag, use lag lock") there
> > used to be a matching mlx5_esw_lock() function and the lock and
> > unlock functions were symmetric.  But now we take the long
>                                                        ^ lock ?

Heh.  Thanks.

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 719ef26d23c0..3e662e389be4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1995,8 +1995,6 @@  int mlx5_esw_try_lock(struct mlx5_eswitch *esw)
  */
 void mlx5_esw_unlock(struct mlx5_eswitch *esw)
 {
-	if (!mlx5_esw_allowed(esw))
-		return;
 	up_write(&esw->mode_lock);
 }