diff mbox

[for-4.1] iw_cxgb4: Fix kbuild bot reported warnings

Message ID 1430246138-3218-1-git-send-email-hariprasad@chelsio.com (mailing list archive)
State Rejected
Headers show

Commit Message

Hariprasad S April 28, 2015, 6:35 p.m. UTC
Commit 20dca80f ("iw_cxgb4: 32b platform fixes") introduced warnings
related to inappropriate argument type while printing arguments

Reported by: Dan Carpenter <dan.carpenter@oracle.com>
Reported by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
---
 drivers/infiniband/hw/cxgb4/cq.c  | 5 +++--
 drivers/infiniband/hw/cxgb4/mem.c | 4 ++--
 drivers/infiniband/hw/cxgb4/qp.c  | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

Comments

Doug Ledford April 28, 2015, 1:57 p.m. UTC | #1
On Wed, 2015-04-29 at 00:05 +0530, Hariprasad Shenai wrote:
> Commit 20dca80f ("iw_cxgb4: 32b platform fixes") introduced warnings
> related to inappropriate argument type while printing arguments

The original patch has not yet been pushed upstream.  There is no need
to submit both it and a fix patch.  I've already modified my copy of
your patch to correct the errors (most of them, there were two spots I
missed that need corrected still).  However, that said...

> Reported by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
> ---
>  drivers/infiniband/hw/cxgb4/cq.c  | 5 +++--
>  drivers/infiniband/hw/cxgb4/mem.c | 4 ++--
>  drivers/infiniband/hw/cxgb4/qp.c  | 4 ++--
>  3 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
> index be66d5d..1f114c0 100644
> --- a/drivers/infiniband/hw/cxgb4/cq.c
> +++ b/drivers/infiniband/hw/cxgb4/cq.c
> @@ -340,7 +340,8 @@ static void advance_oldest_read(struct t4_wq *wq)
>   */
>  void c4iw_flush_hw_cq(struct c4iw_cq *chp)
>  {
> -	struct t4_cqe *hw_cqe, *swcqe, read_cqe;
> +	struct t4_cqe *hw_cqe = NULL;
> +	struct t4_cqe *swcqe, read_cqe;
>  	struct c4iw_qp *qhp;
>  	struct t4_swsqe *swsqe;
>  	int ret;
> @@ -975,7 +976,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
>  		mm2->len = PAGE_SIZE;
>  		insert_mmap(ucontext, mm2);
>  	}
> -	PDBG("%s cqid 0x%0x chp %p size %u memsize %zu, dma_addr 0x%0llx\n",
> +	PDBG("%s cqid 0x%0x chp %p size %u memsize %lu, dma_addr 0x%0llx\n",
>  	     __func__, chp->cq.cqid, chp, chp->cq.size,
>  	     (uintptr_t)chp->cq.memsize,
               ^^^^^^^^^^
               This is still wrong in your fixup.  The uintptr_t is to
be used where you want to shove an int into a ptr or vice versa and you
know that the sizes are appropriate and you don't want the compiler
complaining.  It isn't something that should be used in casting for a
printf format.  So it shouldn't have been added here in the first place.
The right fix is to remove this cast so the original memsize printf
format works properly again.

>  	     (unsigned long long) chp->cq.dma_addr);
              


> diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
> index 9a26649..42805f6 100644
> --- a/drivers/infiniband/hw/cxgb4/mem.c
> +++ b/drivers/infiniband/hw/cxgb4/mem.c
> @@ -930,7 +930,7 @@ struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(struct ib_device *device,
>  
>  	PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
>  	     __func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
> -	     (void *)(uintptr_t)c4pl->dma_addr);
> +	     (dma_addr_t *)(uintptr_t)c4pl->dma_addr);

This is wrong too.  It makes no sense to cast this as uintptr and then
back to dma_addr_t when it was dma_addr_t to begin with.

 
>  	return &c4pl->ibpl;
>  }
> @@ -941,7 +941,7 @@ void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *ibpl)
>  
>  	PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
>  	     __func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
> -	     (void *)(uintptr_t)c4pl->dma_addr);
> +	     (dma_addr_t *)(uintptr_t)c4pl->dma_addr);
>  
>  	dma_free_coherent(&c4pl->dev->rdev.lldi.pdev->dev,
>  			  c4pl->pll_len,
> diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
> index 7ce40c3..176a238 100644
> --- a/drivers/infiniband/hw/cxgb4/qp.c
> +++ b/drivers/infiniband/hw/cxgb4/qp.c
> @@ -1784,8 +1784,8 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
>  	qhp->ibqp.qp_num = qhp->wq.sq.qid;
>  	init_timer(&(qhp->timer));
>  	INIT_LIST_HEAD(&qhp->db_fc_entry);
> -	PDBG("%s sq id %u size %u memsize %zu num_entries %u "
> -	     "rq id %u size %u memsize %zu num_entries %u\n", __func__,
> +	PDBG("%s sq id %u size %u memsize %lu num_entries %u "
> +	     "rq id %u size %u memsize %lu num_entries %u\n", __func__,
>  	     qhp->wq.sq.qid, qhp->wq.sq.size, (unsigned long)qhp->wq.sq.memsize,
>  	     attrs->cap.max_send_wr, qhp->wq.rq.qid, qhp->wq.rq.size,
>  	     (unsigned long)qhp->wq.rq.memsize, attrs->cap.max_recv_wr);
diff mbox

Patch

diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index be66d5d..1f114c0 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -340,7 +340,8 @@  static void advance_oldest_read(struct t4_wq *wq)
  */
 void c4iw_flush_hw_cq(struct c4iw_cq *chp)
 {
-	struct t4_cqe *hw_cqe, *swcqe, read_cqe;
+	struct t4_cqe *hw_cqe = NULL;
+	struct t4_cqe *swcqe, read_cqe;
 	struct c4iw_qp *qhp;
 	struct t4_swsqe *swsqe;
 	int ret;
@@ -975,7 +976,7 @@  struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
 		mm2->len = PAGE_SIZE;
 		insert_mmap(ucontext, mm2);
 	}
-	PDBG("%s cqid 0x%0x chp %p size %u memsize %zu, dma_addr 0x%0llx\n",
+	PDBG("%s cqid 0x%0x chp %p size %u memsize %lu, dma_addr 0x%0llx\n",
 	     __func__, chp->cq.cqid, chp, chp->cq.size,
 	     (uintptr_t)chp->cq.memsize,
 	     (unsigned long long) chp->cq.dma_addr);
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index 9a26649..42805f6 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -930,7 +930,7 @@  struct ib_fast_reg_page_list *c4iw_alloc_fastreg_pbl(struct ib_device *device,
 
 	PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
 	     __func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
-	     (void *)(uintptr_t)c4pl->dma_addr);
+	     (dma_addr_t *)(uintptr_t)c4pl->dma_addr);
 
 	return &c4pl->ibpl;
 }
@@ -941,7 +941,7 @@  void c4iw_free_fastreg_pbl(struct ib_fast_reg_page_list *ibpl)
 
 	PDBG("%s c4pl %p pll_len %u page_list %p dma_addr %pad\n",
 	     __func__, c4pl, c4pl->pll_len, c4pl->ibpl.page_list,
-	     (void *)(uintptr_t)c4pl->dma_addr);
+	     (dma_addr_t *)(uintptr_t)c4pl->dma_addr);
 
 	dma_free_coherent(&c4pl->dev->rdev.lldi.pdev->dev,
 			  c4pl->pll_len,
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 7ce40c3..176a238 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1784,8 +1784,8 @@  struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
 	qhp->ibqp.qp_num = qhp->wq.sq.qid;
 	init_timer(&(qhp->timer));
 	INIT_LIST_HEAD(&qhp->db_fc_entry);
-	PDBG("%s sq id %u size %u memsize %zu num_entries %u "
-	     "rq id %u size %u memsize %zu num_entries %u\n", __func__,
+	PDBG("%s sq id %u size %u memsize %lu num_entries %u "
+	     "rq id %u size %u memsize %lu num_entries %u\n", __func__,
 	     qhp->wq.sq.qid, qhp->wq.sq.size, (unsigned long)qhp->wq.sq.memsize,
 	     attrs->cap.max_send_wr, qhp->wq.rq.qid, qhp->wq.rq.size,
 	     (unsigned long)qhp->wq.rq.memsize, attrs->cap.max_recv_wr);