Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 4f830cd8d7fe ("RDMA/bng_re: Add infrastructure for enabling Firmware channel")
Fixes: 745065770c2d ("RDMA/bng_re: Register and get the resources from bnge driver")
Fixes: 04e031ff6e60 ("RDMA/bng_re: Initialize the Firmware and Hardware")
Fixes: d0da769c19d0 ("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>

authored by

Siva Reddy Kallam and committed by
Leon Romanovsky
7a23af41 9af0feae

+4 -23
+4 -23
drivers/infiniband/hw/bng_re/bng_dev.c
··· 54 54 { 55 55 struct bng_re_chip_ctx *chip_ctx; 56 56 57 - if (!rdev->chip_ctx) 58 - return; 59 - 60 57 kfree(rdev->dev_attr); 61 58 rdev->dev_attr = NULL; 62 59 ··· 121 124 struct bnge_fw_msg fw_msg = {}; 122 125 int rc = -EINVAL; 123 126 124 - if (!rdev) 125 - return rc; 126 - 127 - if (!aux_dev) 128 - return rc; 129 - 130 127 bng_re_init_hwrm_hdr((void *)&req, HWRM_RING_FREE); 131 128 req.ring_type = type; 132 129 req.ring_id = cpu_to_le16(fw_ring_id); ··· 141 150 struct hwrm_ring_alloc_input req = {}; 142 151 struct hwrm_ring_alloc_output resp; 143 152 struct bnge_fw_msg fw_msg = {}; 144 - int rc = -EINVAL; 145 - 146 - if (!aux_dev) 147 - return rc; 153 + int rc; 148 154 149 155 bng_re_init_hwrm_hdr((void *)&req, HWRM_RING_ALLOC); 150 156 req.enables = 0; ··· 172 184 struct hwrm_stat_ctx_free_input req = {}; 173 185 struct hwrm_stat_ctx_free_output resp = {}; 174 186 struct bnge_fw_msg fw_msg = {}; 175 - int rc = -EINVAL; 176 - 177 - if (!aux_dev) 178 - return rc; 187 + int rc; 179 188 180 189 bng_re_init_hwrm_hdr((void *)&req, HWRM_STAT_CTX_FREE); 181 190 req.stat_ctx_id = cpu_to_le32(rdev->stats_ctx.fw_id); ··· 193 208 struct hwrm_stat_ctx_alloc_output resp = {}; 194 209 struct hwrm_stat_ctx_alloc_input req = {}; 195 210 struct bnge_fw_msg fw_msg = {}; 196 - int rc = -EINVAL; 211 + int rc; 197 212 198 213 stats->fw_id = BNGE_INVALID_STATS_CTX_ID; 199 - 200 - if (!aux_dev) 201 - return rc; 202 214 203 215 bng_re_init_hwrm_hdr((void *)&req, HWRM_STAT_CTX_ALLOC); 204 216 req.update_period_ms = cpu_to_le32(1000); ··· 468 486 469 487 rdev = dev_info->rdev; 470 488 471 - if (rdev) 472 - bng_re_remove_device(rdev, adev); 489 + bng_re_remove_device(rdev, adev); 473 490 kfree(dev_info); 474 491 } 475 492