Commit 42cd8dee authored by Gal Pressman's avatar Gal Pressman Committed by Jakub Kicinski
Browse files

net/mlx5: Remove NULL check before dev_{put, hold}



Fix coccinelle warnings:
WARNING: NULL check before dev_{put, hold} functions is not needed.

Signed-off-by: default avatarGal Pressman <gal@nvidia.com>
Reviewed-by: default avatarJianbo Liu <jianbol@nvidia.com>
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Link: https://patch.msgid.link/1742412199-159596-2-git-send-email-tariqt@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c3ad9d9e
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ static void mlx5e_tc_tun_route_attr_cleanup(struct mlx5e_tc_tun_route_attr *attr
{
	if (attr->n)
		neigh_release(attr->n);
	if (attr->route_dev)
	dev_put(attr->route_dev);
}

@@ -68,7 +67,6 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
	 * while holding rcu read lock. Take the net_device for correctness
	 * sake.
	 */
	if (uplink_upper)
	dev_hold(uplink_upper);
	rcu_read_unlock();

@@ -76,7 +74,6 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
			  netif_is_lag_master(uplink_upper) &&
			  real_dev == uplink_upper &&
			  mlx5_lag_is_sriov(priv->mdev));
	if (uplink_upper)
	dev_put(uplink_upper);

	/* if the egress device isn't on the same HW e-switch or
+3 −6
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ static int mlx5e_set_int_port_tunnel(struct mlx5e_priv *priv,
						&attr->action, out_index);

out:
	if (route_dev)
	dev_put(route_dev);

	return err;
@@ -753,7 +752,6 @@ static int mlx5e_set_vf_tunnel(struct mlx5_eswitch *esw,
	}

out:
	if (route_dev)
	dev_put(route_dev);
	return err;
}
@@ -788,7 +786,6 @@ static int mlx5e_update_vf_tunnel(struct mlx5_eswitch *esw,
	mlx5e_tc_match_to_reg_mod_hdr_change(esw->dev, mod_hdr_acts, VPORT_TO_REG, act_id, data);

out:
	if (route_dev)
	dev_put(route_dev);
	return err;
}
+1 −2
Original line number Diff line number Diff line
@@ -523,7 +523,6 @@ static struct net_device *mlx5_lag_active_backup_get_netdev(struct mlx5_core_dev
		ndev = ldev->pf[last_idx].netdev;
	}

	if (ndev)
	dev_hold(ndev);

unlock: