Skip to content

Commit

Permalink
net: qed: Remove unneeded cast from memory allocation
Browse files Browse the repository at this point in the history
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>
Acked-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Aishwarya Ramakrishnan authored and David S. Miller committed Apr 20, 2020
1 parent 5333fdb commit 745e5ad
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions drivers/net/ethernet/qlogic/qed/qed_roce.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 745e5ad

Please sign in to comment.