From patchwork Tue Jun 10 14:02:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 4329001 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 006F49F3B4 for ; Tue, 10 Jun 2014 14:05:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55E66202C8 for ; Tue, 10 Jun 2014 14:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2903B202E9 for ; Tue, 10 Jun 2014 14:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752120AbaFJOFF (ORCPT ); Tue, 10 Jun 2014 10:05:05 -0400 Received: from cmexedge2.ext.emulex.com ([138.239.224.100]:30844 "EHLO CMEXEDGE2.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752059AbaFJOFE (ORCPT ); Tue, 10 Jun 2014 10:05:04 -0400 Received: from CMEXHTCAS1.ad.emulex.com (138.239.115.217) by CMEXEDGE2.ext.emulex.com (138.239.224.100) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 10 Jun 2014 07:05:56 -0700 Received: from localhost.localdomain (10.192.201.1) by smtp.emulex.com (138.239.115.207) with Microsoft SMTP Server id 14.3.174.1; Tue, 10 Jun 2014 07:04:57 -0700 From: Selvin Xavier To: CC: , Devesh Sharma , "Selvin Xavier" Subject: [PATCH v1 for-next 07/16] RDMA/ocrdma: Delete AH table if ocrdma_init_hw fails after AH table creation Date: Tue, 10 Jun 2014 19:32:18 +0530 X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1402408947-2074-7-git-send-email-selvin.xavier@emulex.com> References: <1402408947-2074-1-git-send-email-selvin.xavier@emulex.com> <1402408947-2074-2-git-send-email-selvin.xavier@emulex.com> <1402408947-2074-3-git-send-email-selvin.xavier@emulex.com> <1402408947-2074-4-git-send-email-selvin.xavier@emulex.com> <1402408947-2074-5-git-send-email-selvin.xavier@emulex.com> <1402408947-2074-6-git-send-email-selvin.xavier@emulex.com> <1402408947-2074-7-git-send-email-selvin.xavier@emulex.com> MIME-Version: 1.0 Message-ID: <29a34edf-754f-4a63-b811-70e2ce10f9c1@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=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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: Devesh Sharma Cleanup the AH table in error path, if HW initialization fails after AH table creation. Signed-off-by: Devesh Sharma Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index e6463cb..55308b6 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c @@ -1505,6 +1505,7 @@ static void ocrdma_mbx_delete_ah_tbl(struct ocrdma_dev *dev) ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); dma_free_coherent(&pdev->dev, dev->av_tbl.size, dev->av_tbl.va, dev->av_tbl.pa); + dev->av_tbl.va = NULL; dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->av_tbl.pbl.va, dev->av_tbl.pbl.pa); kfree(cmd); @@ -2882,13 +2883,15 @@ int ocrdma_init_hw(struct ocrdma_dev *dev) goto conf_err; status = ocrdma_mbx_get_phy_info(dev); if (status) - goto conf_err; + goto info_attrb_err; status = ocrdma_mbx_get_ctrl_attribs(dev); if (status) - goto conf_err; + goto info_attrb_err; return 0; +info_attrb_err: + ocrdma_mbx_delete_ah_tbl(dev); conf_err: ocrdma_destroy_mq(dev); mq_err: