linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/qib: remove unused cnt variable
@ 2023-03-30 23:58 Tom Rix
  2023-04-03 18:24 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2023-03-30 23:58 UTC (permalink / raw)
  To: dennis.dalessandro, jgg, leon, nathan, ndesaulniers
  Cc: linux-rdma, linux-kernel, llvm, Tom Rix

clang with W=1 reports
drivers/infiniband/hw/qib/qib_file_ops.c:487:20: error: variable
  'cnt' set but not used [-Werror,-Wunused-but-set-variable]
        u32 tid, ctxttid, cnt, limit, tidcnt;
                          ^
drivers/infiniband/hw/qib/qib_file_ops.c:1771:9: error: variable
  'cnt' set but not used [-Werror,-Wunused-but-set-variable]
        int i, cnt = 0, maxtid = ctxt_tidbase + dd->rcvtidcnt;
               ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/infiniband/hw/qib/qib_file_ops.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c
index 108520e53928..bf0c90eb3129 100644
--- a/drivers/infiniband/hw/qib/qib_file_ops.c
+++ b/drivers/infiniband/hw/qib/qib_file_ops.c
@@ -484,7 +484,7 @@ static int qib_tid_free(struct qib_ctxtdata *rcd, unsigned subctxt,
 			const struct qib_tid_info *ti)
 {
 	int ret = 0;
-	u32 tid, ctxttid, cnt, limit, tidcnt;
+	u32 tid, ctxttid, limit, tidcnt;
 	struct qib_devdata *dd = rcd->dd;
 	u64 __iomem *tidbase;
 	unsigned long tidmap[8];
@@ -520,7 +520,7 @@ static int qib_tid_free(struct qib_ctxtdata *rcd, unsigned subctxt,
 		/* just in case size changes in future */
 		limit = tidcnt;
 	tid = find_first_bit(tidmap, limit);
-	for (cnt = 0; tid < limit; tid++) {
+	for (; tid < limit; tid++) {
 		/*
 		 * small optimization; if we detect a run of 3 or so without
 		 * any set, use find_first_bit again.  That's mainly to
@@ -530,7 +530,7 @@ static int qib_tid_free(struct qib_ctxtdata *rcd, unsigned subctxt,
 		 */
 		if (!test_bit(tid, tidmap))
 			continue;
-		cnt++;
+
 		if (dd->pageshadow[ctxttid + tid]) {
 			struct page *p;
 			dma_addr_t phys;
@@ -1768,7 +1768,7 @@ static void unlock_expected_tids(struct qib_ctxtdata *rcd)
 {
 	struct qib_devdata *dd = rcd->dd;
 	int ctxt_tidbase = rcd->ctxt * dd->rcvtidcnt;
-	int i, cnt = 0, maxtid = ctxt_tidbase + dd->rcvtidcnt;
+	int i, maxtid = ctxt_tidbase + dd->rcvtidcnt;
 
 	for (i = ctxt_tidbase; i < maxtid; i++) {
 		struct page *p = dd->pageshadow[i];
@@ -1783,7 +1783,6 @@ static void unlock_expected_tids(struct qib_ctxtdata *rcd)
 		dma_unmap_page(&dd->pcidev->dev, phys, PAGE_SIZE,
 			       DMA_FROM_DEVICE);
 		qib_release_user_pages(&p, 1);
-		cnt++;
 	}
 }
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] IB/qib: remove unused cnt variable
  2023-03-30 23:58 [PATCH] IB/qib: remove unused cnt variable Tom Rix
@ 2023-04-03 18:24 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2023-04-03 18:24 UTC (permalink / raw)
  To: dennis.dalessandro, jgg, nathan, ndesaulniers, Tom Rix
  Cc: linux-rdma, linux-kernel, llvm


On Thu, 30 Mar 2023 19:58:00 -0400, Tom Rix wrote:
> clang with W=1 reports
> drivers/infiniband/hw/qib/qib_file_ops.c:487:20: error: variable
>   'cnt' set but not used [-Werror,-Wunused-but-set-variable]
>         u32 tid, ctxttid, cnt, limit, tidcnt;
>                           ^
> drivers/infiniband/hw/qib/qib_file_ops.c:1771:9: error: variable
>   'cnt' set but not used [-Werror,-Wunused-but-set-variable]
>         int i, cnt = 0, maxtid = ctxt_tidbase + dd->rcvtidcnt;
>                ^
> This variable is not used so remove it.
> 
> [...]

Applied, thanks!

[1/1] IB/qib: remove unused cnt variable
      https://git.kernel.org/rdma/rdma/c/e7706c4bbfe88f

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-03 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30 23:58 [PATCH] IB/qib: remove unused cnt variable Tom Rix
2023-04-03 18:24 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).