Commit 7a23af41 authored by Siva Reddy Kallam's avatar Siva Reddy Kallam Committed by Leon Romanovsky
Browse files

RDMA/bng_re: Remove unnessary validity checks



Fix below smatch warning:
drivers/infiniband/hw/bng_re/bng_dev.c:113
bng_re_net_ring_free() warn: variable dereferenced before check 'rdev'
(see line 107)

current driver has unnessary validity checks. So, removing these
unnessary validity checks.

Fixes: 4f830cd8 ("RDMA/bng_re: Add infrastructure for enabling Firmware channel")
Fixes: 74506577 ("RDMA/bng_re: Register and get the resources from bnge driver")
Fixes: 04e031ff ("RDMA/bng_re: Initialize the Firmware and Hardware")
Fixes: d0da769c ("RDMA/bng_re: Add Auxiliary interface")
Reported-by: default avatarSimon Horman <horms@kernel.org>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202601010413.sWadrQel-lkp@intel.com/


Signed-off-by: default avatarSiva Reddy Kallam <siva.kallam@broadcom.com>
Link: https://patch.msgid.link/20260218091246.1764808-2-siva.kallam@broadcom.com


Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
parent 9af0feae
Loading
Loading
Loading
Loading
+4 −23
Original line number Diff line number Diff line
@@ -54,9 +54,6 @@ static void bng_re_destroy_chip_ctx(struct bng_re_dev *rdev)
{
	struct bng_re_chip_ctx *chip_ctx;

	if (!rdev->chip_ctx)
		return;

	kfree(rdev->dev_attr);
	rdev->dev_attr = NULL;

@@ -124,12 +121,6 @@ static int bng_re_net_ring_free(struct bng_re_dev *rdev,
	struct bnge_fw_msg fw_msg = {};
	int rc = -EINVAL;

	if (!rdev)
		return rc;

	if (!aux_dev)
		return rc;

	bng_re_init_hwrm_hdr((void *)&req, HWRM_RING_FREE);
	req.ring_type = type;
	req.ring_id = cpu_to_le16(fw_ring_id);
@@ -150,10 +141,7 @@ static int bng_re_net_ring_alloc(struct bng_re_dev *rdev,
	struct hwrm_ring_alloc_input req = {};
	struct hwrm_ring_alloc_output resp;
	struct bnge_fw_msg fw_msg = {};
	int rc = -EINVAL;

	if (!aux_dev)
		return rc;
	int rc;

	bng_re_init_hwrm_hdr((void *)&req, HWRM_RING_ALLOC);
	req.enables = 0;
@@ -184,10 +172,7 @@ static int bng_re_stats_ctx_free(struct bng_re_dev *rdev)
	struct hwrm_stat_ctx_free_input req = {};
	struct hwrm_stat_ctx_free_output resp = {};
	struct bnge_fw_msg fw_msg = {};
	int rc = -EINVAL;

	if (!aux_dev)
		return rc;
	int rc;

	bng_re_init_hwrm_hdr((void *)&req, HWRM_STAT_CTX_FREE);
	req.stat_ctx_id = cpu_to_le32(rdev->stats_ctx.fw_id);
@@ -208,13 +193,10 @@ static int bng_re_stats_ctx_alloc(struct bng_re_dev *rdev)
	struct hwrm_stat_ctx_alloc_output resp = {};
	struct hwrm_stat_ctx_alloc_input req = {};
	struct bnge_fw_msg fw_msg = {};
	int rc = -EINVAL;
	int rc;

	stats->fw_id = BNGE_INVALID_STATS_CTX_ID;

	if (!aux_dev)
		return rc;

	bng_re_init_hwrm_hdr((void *)&req, HWRM_STAT_CTX_ALLOC);
	req.update_period_ms = cpu_to_le32(1000);
	req.stats_dma_addr = cpu_to_le64(stats->dma_map);
@@ -486,7 +468,6 @@ static void bng_re_remove(struct auxiliary_device *adev)

	rdev = dev_info->rdev;

	if (rdev)
	bng_re_remove_device(rdev, adev);
	kfree(dev_info);
}