Skip to contentSkip to conversation

RDMA/bng_re: Remove unused variable rc

PATCH Applied Rohit Chavan 3 participants 3 messages May 5 – May 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/bng_re: Remove unused variable rc

The variable 'rc' is initialized to 0 and returned at the end of bng_re_process_qp_event(), but it is never modified in between.

Simplify the function by removing the redundant variable and returning 0 directly. This cleans up the code and avoids potential compiler warnings about unused variables.

---
 drivers/infiniband/hw/bng_re/bng_fw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bng_re/bng_fw.c +2 -3
index 17d7cc3aa11d..50156c300b33 100644
@@ -123,7 +123,6 @@ static int bng_re_process_qp_event(struct bng_re_rcfw *rcfw,
 	bool is_waiter_alive;
 	struct pci_dev *pdev;
 	u32 wait_cmds = 0;
-	int rc = 0;
 
 	pdev = rcfw->pdev;
 	switch (qp_event->event) {
@@ -152,7 +151,7 @@ static int bng_re_process_qp_event(struct bng_re_rcfw *rcfw,
 				 "rcfw timedout: cookie = %#x, free_slots = %d",
 				 cookie, crsqe->free_slots);
 			spin_unlock(&hwq->lock);
-			return rc;
+			return 0;
 		}
 
 		if (crsqe->is_waiter_alive) {
@@ -182,7 +181,7 @@ static int bng_re_process_qp_event(struct bng_re_rcfw *rcfw,
 		spin_unlock(&hwq->lock);
 	}
 	*num_wait += wait_cmds;
-	return rc;
+	return 0;
 }
 
 /* function events */
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Rohit Chavan

The variable 'rc' is initialized to 0 and returned at the end of bng_re_process_qp_event(), but it is never modified in between.

Simplify the function by removing the redundant variable and returning 0 directly. This cleans up the code and avoids potential compiler warnings about unused variables.

Quoted 37 lines
---
 drivers/infiniband/hw/bng_re/bng_fw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bng_re/bng_fw.c +2 -4
index 17d7cc3aa11d..50156c300b33 100644
@@ -123,7 +123,6 @@ static int bng_re_process_qp_event(struct bng_re_rcfw *rcfw,
        bool is_waiter_alive;
        struct pci_dev *pdev;
        u32 wait_cmds = 0;
-       int rc = 0;
 
        pdev = rcfw->pdev;
        switch (qp_event->event) {
@@ -152,7 +151,7 @@ static int bng_re_process_qp_event(struct bng_re_rcfw *rcfw,
                                 "rcfw timedout: cookie = %#x, free_slots = %d",
                                 cookie, crsqe->free_slots);
                        spin_unlock(&hwq->lock);
-                       return rc;
+                       return 0;
                }
 
                if (crsqe->is_waiter_alive) {
@@ -182,7 +181,7 @@ static int bng_re_process_qp_event(struct bng_re_rcfw *rcfw,
                spin_unlock(&hwq->lock);
        }
        *num_wait += wait_cmds;
-       return rc;
+       return 0;
 }
 
 /* function events */
--

2.34.1

#2 lore raw
In reply to Rohit Chavan
Quoted 8 lines · Rohit Chavan

The variable 'rc' is initialized to 0 and returned at the end of bng_re_process_qp_event(), but it is never modified in between.

Simplify the function by removing the redundant variable and returning 0 directly. This cleans up the code and avoids potential compiler warnings about unused variables.

[...]

Applied, thanks!

[1/1] RDMA/bng_re: Remove unused variable rc

      https://git.kernel.org/rdma/rdma/c/4d575fcf8fdbae

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>