]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
RDMA/bng_re: Remove unnessary validity checks
authorSiva Reddy Kallam <siva.kallam@broadcom.com>
Wed, 18 Feb 2026 09:12:45 +0000 (09:12 +0000)
committerLeon Romanovsky <leonro@nvidia.com>
Tue, 24 Feb 2026 08:53:24 +0000 (03:53 -0500)
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>
drivers/infiniband/hw/bng_re/bng_dev.c

index cf3bf08e5f26e64f2dafcd1ce45828a685532709..b8df807c3a642e5a41f56cc4b064cc99a2d7ca65 100644 (file)
@@ -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,8 +468,7 @@ static void bng_re_remove(struct auxiliary_device *adev)
 
        rdev = dev_info->rdev;
 
-       if (rdev)
-               bng_re_remove_device(rdev, adev);
+       bng_re_remove_device(rdev, adev);
        kfree(dev_info);
 }