Skip to content

Commit 7a23af4

Browse files
siva-kallamrleon
authored andcommitted
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: 4f830cd ("RDMA/bng_re: Add infrastructure for enabling Firmware channel") Fixes: 7450657 ("RDMA/bng_re: Register and get the resources from bnge driver") Fixes: 04e031f ("RDMA/bng_re: Initialize the Firmware and Hardware") Fixes: d0da769 ("RDMA/bng_re: Add Auxiliary interface") Reported-by: Simon Horman <horms@kernel.org> Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202601010413.sWadrQel-lkp@intel.com/ Signed-off-by: Siva Reddy Kallam <siva.kallam@broadcom.com> Link: https://patch.msgid.link/20260218091246.1764808-2-siva.kallam@broadcom.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
1 parent 9af0fea commit 7a23af4

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

drivers/infiniband/hw/bng_re/bng_dev.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ static void bng_re_destroy_chip_ctx(struct bng_re_dev *rdev)
5454
{
5555
struct bng_re_chip_ctx *chip_ctx;
5656

57-
if (!rdev->chip_ctx)
58-
return;
59-
6057
kfree(rdev->dev_attr);
6158
rdev->dev_attr = NULL;
6259

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

127-
if (!rdev)
128-
return rc;
129-
130-
if (!aux_dev)
131-
return rc;
132-
133124
bng_re_init_hwrm_hdr((void *)&req, HWRM_RING_FREE);
134125
req.ring_type = type;
135126
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,
150141
struct hwrm_ring_alloc_input req = {};
151142
struct hwrm_ring_alloc_output resp;
152143
struct bnge_fw_msg fw_msg = {};
153-
int rc = -EINVAL;
154-
155-
if (!aux_dev)
156-
return rc;
144+
int rc;
157145

158146
bng_re_init_hwrm_hdr((void *)&req, HWRM_RING_ALLOC);
159147
req.enables = 0;
@@ -184,10 +172,7 @@ static int bng_re_stats_ctx_free(struct bng_re_dev *rdev)
184172
struct hwrm_stat_ctx_free_input req = {};
185173
struct hwrm_stat_ctx_free_output resp = {};
186174
struct bnge_fw_msg fw_msg = {};
187-
int rc = -EINVAL;
188-
189-
if (!aux_dev)
190-
return rc;
175+
int rc;
191176

192177
bng_re_init_hwrm_hdr((void *)&req, HWRM_STAT_CTX_FREE);
193178
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)
208193
struct hwrm_stat_ctx_alloc_output resp = {};
209194
struct hwrm_stat_ctx_alloc_input req = {};
210195
struct bnge_fw_msg fw_msg = {};
211-
int rc = -EINVAL;
196+
int rc;
212197

213198
stats->fw_id = BNGE_INVALID_STATS_CTX_ID;
214199

215-
if (!aux_dev)
216-
return rc;
217-
218200
bng_re_init_hwrm_hdr((void *)&req, HWRM_STAT_CTX_ALLOC);
219201
req.update_period_ms = cpu_to_le32(1000);
220202
req.stats_dma_addr = cpu_to_le64(stats->dma_map);
@@ -486,8 +468,7 @@ static void bng_re_remove(struct auxiliary_device *adev)
486468

487469
rdev = dev_info->rdev;
488470

489-
if (rdev)
490-
bng_re_remove_device(rdev, adev);
471+
bng_re_remove_device(rdev, adev);
491472
kfree(dev_info);
492473
}
493474

0 commit comments

Comments
 (0)