From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8193CC433FE for ; Wed, 30 Nov 2022 18:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbiK3SzJ (ORCPT ); Wed, 30 Nov 2022 13:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231582AbiK3SzH (ORCPT ); Wed, 30 Nov 2022 13:55:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1336C8FD65 for ; Wed, 30 Nov 2022 10:55:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BF41DB81C9F for ; Wed, 30 Nov 2022 18:55:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23F92C433C1; Wed, 30 Nov 2022 18:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669834503; bh=zATKBruJEbS9/K5LcSmtgTYJmmhqPIEx0VmGc2c278A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VC0chcT2QJdWAnQFbgv0cH14Y0amvjhatFaNUbE0lSIg311GtsHamotJBosq0C+1o Kc88zfvCKnYDTJ0bdBnaJTt3J3zb0tJjqFe7JIBAaLVY9avIUIQEFncGEK0Axtyxve nlk2LiJqmQCAxJCT/b3g4HTA5eWfX3v43BiFxZqU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qu Wenruo , Zhen Lei , David Sterba Subject: [PATCH 6.0 277/289] btrfs: sysfs: normalize the error handling branch in btrfs_init_sysfs() Date: Wed, 30 Nov 2022 19:24:22 +0100 Message-Id: <20221130180550.381936194@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221130180544.105550592@linuxfoundation.org> References: <20221130180544.105550592@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhen Lei commit ffdbb44f2f23f963b8f5672e35c3a26088177a62 upstream. Although kset_unregister() can eventually remove all attribute files, explicitly rolling back with the matching function makes the code logic look clearer. CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Qu Wenruo Signed-off-by: Zhen Lei Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/sysfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -2251,8 +2251,11 @@ int __init btrfs_init_sysfs(void) #ifdef CONFIG_BTRFS_DEBUG ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_debug_feature_attr_group); - if (ret) - goto out2; + if (ret) { + sysfs_unmerge_group(&btrfs_kset->kobj, + &btrfs_static_feature_attr_group); + goto out_remove_group; + } #endif return 0;