From patchwork Wed Dec 13 17:36:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10110483 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 5954160352 for ; Wed, 13 Dec 2017 17:36:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4275D289E2 for ; Wed, 13 Dec 2017 17:36:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36D5528A0D; Wed, 13 Dec 2017 17:36:38 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B243B289E2 for ; Wed, 13 Dec 2017 17:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lpTNBG51sjkkAM2QQuDovlny35UIyVmywjhzjn+xEDk=; b=m9mdqModgcfkkq g3mbeIR01fIjo+5MC01IZDcu0G8ZPsCv4bbSYv+px3ho3z21QxYKgvMWvk0rirdio6zTcoAb1i+74 jUrl2TDqiNcP7dNWT+jp4AoP8/aWRlio/13/Oh8kHpO4AxwQENBoC+6217ojKs3PUgRkLwJBW3pnM B+2Po+pFskQ28whkgMiaPaWwxGkLuv9ZU7e8+nZD/dc1w2II65fn+Kn+PGCjCVNJpaVSY1HDAnrML J3CwIj/wSwbaDeppgaUhZ2E6SVg9gpRsKFO5rx23SuiT8ZJr6kosJqdiCr8REUJuLdTXV0Z6c5SBg MMobzR7AD89+TH9dvS+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePAxQ-00056y-Rg; Wed, 13 Dec 2017 17:36:36 +0000 Received: from mout.web.de ([212.227.15.3]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ePAxN-0004QK-Rd for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2017 17:36:35 +0000 Received: from [192.168.1.3] ([77.181.208.154]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LrbHJ-1fAEhY0unl-013Pt5; Wed, 13 Dec 2017 18:36:09 +0100 Subject: [PATCH 3/3] soc/fsl/qe: Use common error handling code in ucc_fast_init() From: SF Markus Elfring To: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Li Yang , Qiang Zhao References: <07738369-a787-98b4-41a5-71b7d630c356@users.sourceforge.net> Message-ID: <9668351a-8189-037f-5912-5663ac8706b1@users.sourceforge.net> Date: Wed, 13 Dec 2017 18:36:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <07738369-a787-98b4-41a5-71b7d630c356@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:j/Y98nmTnz1uX9U/kn81traMQ2fLl/RFWBz9GSWxfq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Ti73aldFbs030L9N3DHjg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171213_093634_236035_063B0151 X-CRM114-Status: UNSURE ( 9.54 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 13 Dec 2017 18:18:56 +0100 Add jump targets so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring --- drivers/soc/fsl/qe/ucc_fast.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/soc/fsl/qe/ucc_fast.c b/drivers/soc/fsl/qe/ucc_fast.c index 2092bfdcf1bc..268dfc5dc89b 100644 --- a/drivers/soc/fsl/qe/ucc_fast.c +++ b/drivers/soc/fsl/qe/ucc_fast.c @@ -269,8 +269,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc printk(KERN_ERR "%s: cannot allocate MURAM for TX FIFO\n", __func__); uccf->ucc_fast_tx_virtual_fifo_base_offset = 0; - ucc_fast_free(uccf); - return -ENOMEM; + goto free_nomem; } /* Allocate memory for Rx Virtual Fifo */ @@ -282,8 +281,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc printk(KERN_ERR "%s: cannot allocate MURAM for RX FIFO\n", __func__); uccf->ucc_fast_rx_virtual_fifo_base_offset = 0; - ucc_fast_free(uccf); - return -ENOMEM; + goto free_nomem; } /* Set Virtual Fifo registers */ @@ -312,8 +310,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc COMM_DIR_RX)) { printk(KERN_ERR "%s: illegal value for RX clock\n", __func__); - ucc_fast_free(uccf); - return -EINVAL; + goto free_inval; } /* Tx clock routing */ if ((uf_info->tx_clock != QE_CLK_NONE) && @@ -321,8 +318,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc COMM_DIR_TX)) { printk(KERN_ERR "%s: illegal value for TX clock\n", __func__); - ucc_fast_free(uccf); - return -EINVAL; + goto free_inval; } } else { /* tdm Rx clock routing */ @@ -330,8 +326,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc ucc_set_tdm_rxtx_clk(uf_info->tdm_num, uf_info->rx_clock, COMM_DIR_RX)) { pr_err("%s: illegal value for RX clock", __func__); - ucc_fast_free(uccf); - return -EINVAL; + goto free_inval; } /* tdm Tx clock routing */ @@ -339,8 +334,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc ucc_set_tdm_rxtx_clk(uf_info->tdm_num, uf_info->tx_clock, COMM_DIR_TX)) { pr_err("%s: illegal value for TX clock", __func__); - ucc_fast_free(uccf); - return -EINVAL; + goto free_inval; } /* tdm Rx sync clock routing */ @@ -348,8 +342,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc ucc_set_tdm_rxtx_sync(uf_info->tdm_num, uf_info->rx_sync, COMM_DIR_RX)) { pr_err("%s: illegal value for RX clock", __func__); - ucc_fast_free(uccf); - return -EINVAL; + goto free_inval; } /* tdm Tx sync clock routing */ @@ -357,8 +350,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc ucc_set_tdm_rxtx_sync(uf_info->tdm_num, uf_info->tx_sync, COMM_DIR_TX)) { pr_err("%s: illegal value for TX clock", __func__); - ucc_fast_free(uccf); - return -EINVAL; + goto free_inval; } } @@ -374,6 +366,14 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc *uccf_ret = uccf; return 0; + +free_nomem: + ucc_fast_free(uccf); + return -ENOMEM; + +free_inval: + ucc_fast_free(uccf); + return -EINVAL; } EXPORT_SYMBOL(ucc_fast_init);