Commit 9ba1377daa51 ("RDMA/ocrdma: Move PD resource management to driver.")
modified the err exit path in function ocrdma_alloc_pd() so that a call of
_ocrdma_dealloc_pd(dev, pd) is followed by kfree(pd). However,
_ocrdma_dealloc_pd() already unconditionally frees argument pd. Thus remove
the double free. Detected by Coverity CID 1271296.

Signed-off-by: Christian Engelmayer <[email protected]>
---
Compile tested only. Applies against linux-next.
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 877175563634..74219d288aea 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -675,12 +675,10 @@ pd_mapping:
        return &pd->ibpd;
 
 err:
-       if (is_uctx_pd) {
+       if (is_uctx_pd)
                ocrdma_release_ucontext_pd(uctx);
-       } else {
+       else
                status = _ocrdma_dealloc_pd(dev, pd);
-               kfree(pd);
-       }
 exit:
        return ERR_PTR(status);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to