From patchwork Thu Apr 27 09:13:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9702611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7A7F6032C for ; Thu, 27 Apr 2017 09:14:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFD202860F for ; Thu, 27 Apr 2017 09:14:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2CB828623; Thu, 27 Apr 2017 09:14:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 790422860F for ; Thu, 27 Apr 2017 09:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032040AbdD0JOD (ORCPT ); Thu, 27 Apr 2017 05:14:03 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:49783 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032026AbdD0JOA (ORCPT ); Thu, 27 Apr 2017 05:14:00 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3R9Dtet021372 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Apr 2017 09:13:55 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v3R9DseJ008686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 Apr 2017 09:13:55 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v3R9DqrE001769; Thu, 27 Apr 2017 09:13:53 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 27 Apr 2017 02:13:51 -0700 Date: Thu, 27 Apr 2017 12:13:45 +0300 From: Dan Carpenter To: Alan Tull Cc: Moritz Fischer , linux-fpga@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] fpga: region: Fix some error handling Message-ID: <20170427091345.a6vpeapnesey7k6d@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-fpga-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need to release some resources if fpga_region_get_manager() fails. Fixes: 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA") Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-fpga" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c index ae4c61aada99..3b6b2f4182a1 100644 --- a/drivers/fpga/fpga-region.c +++ b/drivers/fpga/fpga-region.c @@ -245,7 +245,8 @@ static int fpga_region_program_fpga(struct fpga_region *region, mgr = fpga_region_get_manager(region); if (IS_ERR(mgr)) { pr_err("failed to get fpga region manager\n"); - return PTR_ERR(mgr); + ret = PTR_ERR(mgr); + goto err_put_region; } ret = fpga_region_get_bridges(region, overlay); @@ -281,6 +282,7 @@ static int fpga_region_program_fpga(struct fpga_region *region, fpga_bridges_put(®ion->bridge_list); err_put_mgr: fpga_mgr_put(mgr); +err_put_region: fpga_region_put(region); return ret;