All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: qed: Remove unneeded cast from memory allocation
@ 2020-04-19 16:29 Aishwarya Ramakrishnan
  2020-04-20  5:11 ` [EXT] " Michal Kalderon
  2020-04-20 19:23 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Aishwarya Ramakrishnan @ 2020-04-19 16:29 UTC (permalink / raw)
  To: Ariel Elior, GR-everest-linux-l2, David S. Miller, netdev, linux-kernel
  Cc: aishwaryarj100

Remove casting the values returned by memory allocation function.

Coccinelle emits WARNING: casting value returned by memory allocation
function to struct pointer is useless.

This issue was detected by using the Coccinelle.

Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
---
 drivers/net/ethernet/qlogic/qed/qed_roce.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
index 37e70562a964..475b89903f46 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
@@ -736,9 +736,9 @@ static int qed_roce_sp_destroy_qp_responder(struct qed_hwfn *p_hwfn,
 
 	p_ramrod = &p_ent->ramrod.roce_destroy_qp_resp;
 
-	p_ramrod_res = (struct roce_destroy_qp_resp_output_params *)
-	    dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, sizeof(*p_ramrod_res),
-			       &ramrod_res_phys, GFP_KERNEL);
+	p_ramrod_res = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
+					  sizeof(*p_ramrod_res),
+					  &ramrod_res_phys, GFP_KERNEL);
 
 	if (!p_ramrod_res) {
 		rc = -ENOMEM;
@@ -872,10 +872,10 @@ int qed_roce_query_qp(struct qed_hwfn *p_hwfn,
 	}
 
 	/* Send a query responder ramrod to FW to get RQ-PSN and state */
-	p_resp_ramrod_res = (struct roce_query_qp_resp_output_params *)
-	    dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
-			       sizeof(*p_resp_ramrod_res),
-			       &resp_ramrod_res_phys, GFP_KERNEL);
+	p_resp_ramrod_res =
+		dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
+				   sizeof(*p_resp_ramrod_res),
+				   &resp_ramrod_res_phys, GFP_KERNEL);
 	if (!p_resp_ramrod_res) {
 		DP_NOTICE(p_hwfn,
 			  "qed query qp failed: cannot allocate memory (ramrod)\n");
@@ -920,8 +920,7 @@ int qed_roce_query_qp(struct qed_hwfn *p_hwfn,
 	}
 
 	/* Send a query requester ramrod to FW to get SQ-PSN and state */
-	p_req_ramrod_res = (struct roce_query_qp_req_output_params *)
-			   dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
+	p_req_ramrod_res = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
 					      sizeof(*p_req_ramrod_res),
 					      &req_ramrod_res_phys,
 					      GFP_KERNEL);
-- 
2.17.1


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

* RE: [EXT] [PATCH] net: qed: Remove unneeded cast from memory allocation
  2020-04-19 16:29 [PATCH] net: qed: Remove unneeded cast from memory allocation Aishwarya Ramakrishnan
@ 2020-04-20  5:11 ` Michal Kalderon
  2020-04-20 19:23 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Kalderon @ 2020-04-20  5:11 UTC (permalink / raw)
  To: Aishwarya Ramakrishnan, Ariel Elior, GR-everest-linux-l2,
	David S. Miller, netdev, linux-kernel

> From: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
> Sent: Sunday, April 19, 2020 7:29 PM
> 
> ----------------------------------------------------------------------
> Remove casting the values returned by memory allocation function.
> 
> Coccinelle emits WARNING: casting value returned by memory allocation
> function to struct pointer is useless.
> 
> This issue was detected by using the Coccinelle.
> 
> Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
> ---
>  drivers/net/ethernet/qlogic/qed/qed_roce.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c
> b/drivers/net/ethernet/qlogic/qed/qed_roce.c
> index 37e70562a964..475b89903f46 100644
> --- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
> +++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
> @@ -736,9 +736,9 @@ static int qed_roce_sp_destroy_qp_responder(struct
> qed_hwfn *p_hwfn,
> 
>  	p_ramrod = &p_ent->ramrod.roce_destroy_qp_resp;
> 
> -	p_ramrod_res = (struct roce_destroy_qp_resp_output_params *)
> -	    dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
> sizeof(*p_ramrod_res),
> -			       &ramrod_res_phys, GFP_KERNEL);
> +	p_ramrod_res = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
> +					  sizeof(*p_ramrod_res),
> +					  &ramrod_res_phys, GFP_KERNEL);
> 
>  	if (!p_ramrod_res) {
>  		rc = -ENOMEM;
> @@ -872,10 +872,10 @@ int qed_roce_query_qp(struct qed_hwfn
> *p_hwfn,
>  	}
> 
>  	/* Send a query responder ramrod to FW to get RQ-PSN and state */
> -	p_resp_ramrod_res = (struct roce_query_qp_resp_output_params
> *)
> -	    dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
> -			       sizeof(*p_resp_ramrod_res),
> -			       &resp_ramrod_res_phys, GFP_KERNEL);
> +	p_resp_ramrod_res =
> +		dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
> +				   sizeof(*p_resp_ramrod_res),
> +				   &resp_ramrod_res_phys, GFP_KERNEL);
>  	if (!p_resp_ramrod_res) {
>  		DP_NOTICE(p_hwfn,
>  			  "qed query qp failed: cannot allocate memory
> (ramrod)\n"); @@ -920,8 +920,7 @@ int qed_roce_query_qp(struct
> qed_hwfn *p_hwfn,
>  	}
> 
>  	/* Send a query requester ramrod to FW to get SQ-PSN and state */
> -	p_req_ramrod_res = (struct roce_query_qp_req_output_params *)
> -			   dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
> +	p_req_ramrod_res = dma_alloc_coherent(&p_hwfn->cdev->pdev-
> >dev,
>  					      sizeof(*p_req_ramrod_res),
>  					      &req_ramrod_res_phys,
>  					      GFP_KERNEL);
> --
> 2.17.1

Thanks, 

Acked-by: Michal Kalderon <michal.kalderon@marvell.com>



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

* Re: [PATCH] net: qed: Remove unneeded cast from memory allocation
  2020-04-19 16:29 [PATCH] net: qed: Remove unneeded cast from memory allocation Aishwarya Ramakrishnan
  2020-04-20  5:11 ` [EXT] " Michal Kalderon
@ 2020-04-20 19:23 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-04-20 19:23 UTC (permalink / raw)
  To: aishwaryarj100; +Cc: aelior, GR-everest-linux-l2, netdev, linux-kernel

From: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
Date: Sun, 19 Apr 2020 21:59:17 +0530

> Remove casting the values returned by memory allocation function.
> 
> Coccinelle emits WARNING: casting value returned by memory allocation
> function to struct pointer is useless.
> 
> This issue was detected by using the Coccinelle.
> 
> Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>

Applied to net-next, thanks.

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

end of thread, other threads:[~2020-04-20 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 16:29 [PATCH] net: qed: Remove unneeded cast from memory allocation Aishwarya Ramakrishnan
2020-04-20  5:11 ` [EXT] " Michal Kalderon
2020-04-20 19:23 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.