target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/srpt: fix function pointer cast warnings
@ 2024-02-13 10:07 Arnd Bergmann
  2024-02-13 21:23 ` Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2024-02-13 10:07 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Arnd Bergmann, Jason Gunthorpe, Leon Romanovsky,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Martin K. Petersen, Nicholas A. Bellinger, linux-rdma,
	target-devel, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

clang-16 notices that srpt_qp_event() gets called through an incompatible
pointer here:

drivers/infiniband/ulp/srpt/ib_srpt.c:1815:5: error: cast from 'void (*)(struct ib_event *, struct srpt_rdma_ch *)' to 'void (*)(struct ib_event *, void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1815 |                 = (void(*)(struct ib_event *, void*))srpt_qp_event;

Change srpt_qp_event() to use the correct prototype and adjust the
argument inside of it.

Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 0875f197118f..942b311b6296 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -216,8 +216,10 @@ static const char *get_ch_state_name(enum rdma_ch_state s)
  * @event: Description of the event that occurred.
  * @ch: SRPT RDMA channel.
  */
-static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
+static void srpt_qp_event(struct ib_event *event, void *ptr)
 {
+	struct srpt_rdma_ch *ch = ptr;
+
 	pr_debug("QP event %d on ch=%p sess_name=%s-%d state=%s\n",
 		 event->event, ch, ch->sess_name, ch->qp->qp_num,
 		 get_ch_state_name(ch->state));
@@ -1811,8 +1813,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
 	ch->cq_size = ch->rq_size + sq_size;
 
 	qp_init->qp_context = (void *)ch;
-	qp_init->event_handler
-		= (void(*)(struct ib_event *, void*))srpt_qp_event;
+	qp_init->event_handler = srpt_qp_event;
 	qp_init->send_cq = ch->cq;
 	qp_init->recv_cq = ch->cq;
 	qp_init->sq_sig_type = IB_SIGNAL_REQ_WR;
-- 
2.39.2


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

* Re: [PATCH] RDMA/srpt: fix function pointer cast warnings
  2024-02-13 10:07 [PATCH] RDMA/srpt: fix function pointer cast warnings Arnd Bergmann
@ 2024-02-13 21:23 ` Bart Van Assche
  2024-02-14  9:21 ` Leon Romanovsky
  2024-02-14  9:24 ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2024-02-13 21:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Jason Gunthorpe, Leon Romanovsky,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Martin K. Petersen, Nicholas A. Bellinger, linux-rdma,
	target-devel, linux-kernel, llvm

On 2/13/24 02:07, Arnd Bergmann wrote:
> Change srpt_qp_event() to use the correct prototype and adjust the
> argument inside of it.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

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

* Re: [PATCH] RDMA/srpt: fix function pointer cast warnings
  2024-02-13 10:07 [PATCH] RDMA/srpt: fix function pointer cast warnings Arnd Bergmann
  2024-02-13 21:23 ` Bart Van Assche
@ 2024-02-14  9:21 ` Leon Romanovsky
  2024-02-14  9:24 ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2024-02-14  9:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bart Van Assche, Arnd Bergmann, Jason Gunthorpe,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Martin K. Petersen, Nicholas A. Bellinger, linux-rdma,
	target-devel, linux-kernel, llvm

On Tue, Feb 13, 2024 at 11:07:13AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> clang-16 notices that srpt_qp_event() gets called through an incompatible
> pointer here:
> 
> drivers/infiniband/ulp/srpt/ib_srpt.c:1815:5: error: cast from 'void (*)(struct ib_event *, struct srpt_rdma_ch *)' to 'void (*)(struct ib_event *, void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>  1815 |                 = (void(*)(struct ib_event *, void*))srpt_qp_event;
> 
> Change srpt_qp_event() to use the correct prototype and adjust the
> argument inside of it.
> 
> Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/infiniband/ulp/srpt/ib_srpt.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)


This patch generates the following warnings, fixed and applied.
➜  kernel git:(wip/leon-for-rc) mkt ci
f17a855457db (HEAD -> build) RDMA/srpt: fix function pointer cast warnings
drivers/infiniband/ulp/srpt/ib_srpt.c:220: warning: Function parameter or struct member 'ptr' not described in 'srpt_qp_event'
drivers/infiniband/ulp/srpt/ib_srpt.c:220: warning: Excess function parameter 'ch' description in 'srpt_qp_event'
drivers/infiniband/ulp/srpt/ib_srpt.c:220: warning: Function parameter or struct member 'ptr' not described in 'srpt_qp_event'
drivers/infiniband/ulp/srpt/ib_srpt.c:220: warning: Excess function parameter 'ch' description in 'srpt_qp_event'


> 
> diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
> index 0875f197118f..942b311b6296 100644
> --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
> +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
> @@ -216,8 +216,10 @@ static const char *get_ch_state_name(enum rdma_ch_state s)
>   * @event: Description of the event that occurred.
>   * @ch: SRPT RDMA channel.
>   */
> -static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
> +static void srpt_qp_event(struct ib_event *event, void *ptr)
>  {
> +	struct srpt_rdma_ch *ch = ptr;
> +
>  	pr_debug("QP event %d on ch=%p sess_name=%s-%d state=%s\n",
>  		 event->event, ch, ch->sess_name, ch->qp->qp_num,
>  		 get_ch_state_name(ch->state));
> @@ -1811,8 +1813,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
>  	ch->cq_size = ch->rq_size + sq_size;
>  
>  	qp_init->qp_context = (void *)ch;
> -	qp_init->event_handler
> -		= (void(*)(struct ib_event *, void*))srpt_qp_event;
> +	qp_init->event_handler = srpt_qp_event;
>  	qp_init->send_cq = ch->cq;
>  	qp_init->recv_cq = ch->cq;
>  	qp_init->sq_sig_type = IB_SIGNAL_REQ_WR;
> -- 
> 2.39.2
> 

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

* Re: [PATCH] RDMA/srpt: fix function pointer cast warnings
  2024-02-13 10:07 [PATCH] RDMA/srpt: fix function pointer cast warnings Arnd Bergmann
  2024-02-13 21:23 ` Bart Van Assche
  2024-02-14  9:21 ` Leon Romanovsky
@ 2024-02-14  9:24 ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2024-02-14  9:24 UTC (permalink / raw)
  To: Bart Van Assche, Arnd Bergmann
  Cc: Arnd Bergmann, Jason Gunthorpe, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Martin K. Petersen,
	Nicholas A. Bellinger, linux-rdma, target-devel, linux-kernel,
	llvm


On Tue, 13 Feb 2024 11:07:13 +0100, Arnd Bergmann wrote:
> clang-16 notices that srpt_qp_event() gets called through an incompatible
> pointer here:
> 
> drivers/infiniband/ulp/srpt/ib_srpt.c:1815:5: error: cast from 'void (*)(struct ib_event *, struct srpt_rdma_ch *)' to 'void (*)(struct ib_event *, void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>  1815 |                 = (void(*)(struct ib_event *, void*))srpt_qp_event;
> 
> Change srpt_qp_event() to use the correct prototype and adjust the
> argument inside of it.
> 
> [...]

Applied, thanks!

[1/1] RDMA/srpt: fix function pointer cast warnings
      https://git.kernel.org/rdma/rdma/c/eb5c7465c32401

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

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

end of thread, other threads:[~2024-02-14  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 10:07 [PATCH] RDMA/srpt: fix function pointer cast warnings Arnd Bergmann
2024-02-13 21:23 ` Bart Van Assche
2024-02-14  9:21 ` Leon Romanovsky
2024-02-14  9: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).