From patchwork Sat Jan 17 10:07:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 5651891 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A0C6C9F2ED for ; Sat, 17 Jan 2015 10:56:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8747203C1 for ; Sat, 17 Jan 2015 10:56:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7CBA203B6 for ; Sat, 17 Jan 2015 10:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751471AbbAQK4M (ORCPT ); Sat, 17 Jan 2015 05:56:12 -0500 Received: from cmexedge1.emulex.com ([138.239.224.99]:51840 "EHLO CMEXEDGE1.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbbAQK4L (ORCPT ); Sat, 17 Jan 2015 05:56:11 -0500 Received: from CMEXHTCAS1.ad.emulex.com (138.239.115.217) by CMEXEDGE1.ext.emulex.com (138.239.224.99) with Microsoft SMTP Server (TLS) id 14.3.174.1; Sat, 17 Jan 2015 02:55:50 -0800 Received: from neo01-el64.lab.bg.emulex.com (10.192.204.8) by smtp.emulex.com (138.239.115.207) with Microsoft SMTP Server id 14.3.174.1; Sat, 17 Jan 2015 02:55:31 -0800 From: Devesh Sharma To: CC: Padmanabh Ratnakar , Devesh Sharma Subject: [PATCH] RDMA/libocrdma: return error if destroy fails Date: Sat, 17 Jan 2015 15:37:23 +0530 X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 Message-ID: <12d6c580-1a1f-4da4-b3e1-12b75e2f983b@CMEXHTCAS1.ad.emulex.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Padmanabh Ratnakar If the destorying of any resource has failed at uverbs command interface libocrdma should return the error code. Signed-off-by: Padmanabh Ratnakar Signed-off-by: Devesh Sharma --- src/ocrdma_verbs.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ocrdma_verbs.c b/src/ocrdma_verbs.c index c089a5f..cf2ecd2 100644 --- a/src/ocrdma_verbs.c +++ b/src/ocrdma_verbs.c @@ -209,10 +209,11 @@ int ocrdma_free_pd(struct ibv_pd *ibpd) struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); status = ibv_cmd_dealloc_pd(ibpd); - if (pd->dpp_va) - munmap((void *)pd->dpp_va, OCRDMA_DPP_PAGE_SIZE); if (status) return status; + + if (pd->dpp_va) + munmap((void *)pd->dpp_va, OCRDMA_DPP_PAGE_SIZE); free(pd); return 0; } @@ -356,8 +357,12 @@ int ocrdma_resize_cq(struct ibv_cq *ibcq, int new_entries) int ocrdma_destroy_cq(struct ibv_cq *ibv_cq) { struct ocrdma_cq *cq = get_ocrdma_cq(ibv_cq); + int status; + + status = ibv_cmd_destroy_cq(ibv_cq); + if (status) + return status; - ibv_cmd_destroy_cq(ibv_cq); if (cq->db_va) munmap((void *)cq->db_va, cq->db_size); if (cq->va) @@ -484,6 +489,9 @@ int ocrdma_destroy_srq(struct ibv_srq *ibsrq) id = dev->id; status = ibv_cmd_destroy_srq(ibsrq); + if (status) + return status; + if (srq->idx_bit_fields) free(srq->idx_bit_fields); if (srq->rqe_wr_id_tbl)