From patchwork Mon Aug 21 12:41:43 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: 9912433 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 A7D46602D8 for ; Mon, 21 Aug 2017 12:42:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F9552874F for ; Mon, 21 Aug 2017 12:42:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 942DD28788; Mon, 21 Aug 2017 12:42:06 +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 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 50E832874F for ; Mon, 21 Aug 2017 12:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753747AbdHUMl5 (ORCPT ); Mon, 21 Aug 2017 08:41:57 -0400 Received: from mout.web.de ([212.227.15.4]:57686 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753141AbdHUMlz (ORCPT ); Mon, 21 Aug 2017 08:41:55 -0400 Received: from [192.168.1.2] ([85.182.36.210]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LqoAk-1d5TSt095u-00eMQc; Mon, 21 Aug 2017 14:41:45 +0200 Subject: [PATCH 4/5] btrfs: Use common error handling code in update_ref_path() From: SF Markus Elfring To: linux-btrfs@vger.kernel.org, Chris Mason , David Sterba , Josef Bacik Cc: LKML , kernel-janitors@vger.kernel.org References: <1e8e1da2-a9e3-9dc7-6ffe-6c32f8464337@users.sourceforge.net> Message-ID: <7083c299-4803-68c8-ae57-c0e74f5d9229@users.sourceforge.net> Date: Mon, 21 Aug 2017 14:41:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1e8e1da2-a9e3-9dc7-6ffe-6c32f8464337@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:SDdalDBxeBuFwM/BaDMU0It9Xbq+5RgjN45MiIJIPVEOA3rGodA 1SuFSa1lrhHFH1cIUm8GcH128iaHi6a3qflEoNVJvotsFBRl2ccvSaCk+IHu89W6ZDL4Vl0 ZcOnbRAgaLkC35GHkYOg2y8mj6hDRg/n21aHu8C2L+f1C0hKuWYl70m6skHdLA/SoLPhW04 RPYDWiWAX6V6Ko8OUR0tA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Q0nfkaDXmXQ=:k7mIKY7KoM5B4TRUc3R44c u2tEXC1/FnvsmsYEAvMDgxUwGkF0a9oLSxXeU7QGxnz+Sy1TGAvFyPFnIxp1uxQHpI2PDzo8U qeud8OOmB8Bxl4dPqMaf5cjBscmmzmdIDXCG1jPDm5rGONSxeqoTt9q4+d5HZhrpInCR5NOMQ et+2KVf1HB/h87isOXTs9Dk50qEqvFQ0Ce+aXe/y6YEFaZGjujhKcMUlfoENMydGQ5fennkPO sVkjbLtm5QSwJphKSQttpTMMHHs3fu7hDs/toI5I3Amo8RQXLQG/IWezApyX/tU0FRO6uzbvI 4VGuRPOMzGGqP/peVBsIjIp2CG1+nhePxq8De3i6xYd8lBe0ANqILbueuu9qofZyIImPYTdQS UZvrmpTe4QpqIj3xf+bcIiZuWM9b9p+yaC6quIaD9IhZk9dEMTT/kXRbfn5CzGyoYcDzfcL0T g1+U3f5+Dgn8HIcI6RHdCdXxiLF7QBoDMu0zIWt4JTMplQaUzVRqEuQzgAsxyb1GufvRXg6zT DvSEbXeaMTvxSgNSaqSb0wPFN4N9YUNQmsxH/x+HKqYPrgqVqRr9FzSv70EYmV3akdm4KhD7m Jf38iypzth16QCqmrXtF+BQBo3bZGyEyq1G1qd4qijsnOn/BePW2p4vJNgd1k+OKCz3aSUoeM xbIyz5j3GBevo1Gjeg2GyveSlTJPISo8XO40LUQNauHGQ326NBoxeFVVWGn6d0SNjOAeCcbHL b7WoqKmJtXz7wpXctXrc86G3tEw/TQYPK10R55GkUCXsMu4gyzDBZh8qGu2GB0Sb3pvFriJLn AJCYTIfZIJL/T+2XVuo0dl6GEZqktYr56I4dswOg4ZF30RXdpcMFtFUovePkctKDJXaEJVQ Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 21 Aug 2017 13:34:29 +0200 Add a jump target so that a bit of exception handling can be better reused in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- fs/btrfs/send.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 59fb1ed6ca20..a96edc91a101 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -3697,12 +3697,12 @@ static int update_ref_path(struct send_ctx *sctx, struct recorded_ref *ref) return -ENOMEM; ret = get_cur_path(sctx, ref->dir, ref->dir_gen, new_path); - if (ret < 0) { - fs_path_free(new_path); - return ret; - } + if (ret < 0) + goto free_path; + ret = fs_path_add(new_path, ref->name, ref->name_len); if (ret < 0) { +free_path: fs_path_free(new_path); return ret; }