From patchwork Wed Jun 14 06:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 107725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1037254vqr; Tue, 13 Jun 2023 23:34:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/CYm0R0V7E1b6pAz61kpRbm0LWgT9653v5Ipq7OypX6qYmiEa46zdAjC4rJQd/v4Vrcxq X-Received: by 2002:a05:651c:1039:b0:2af:d2ef:49d4 with SMTP id w25-20020a05651c103900b002afd2ef49d4mr5623789ljm.1.1686724467562; Tue, 13 Jun 2023 23:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686724467; cv=none; d=google.com; s=arc-20160816; b=nhNoVy8mV9nB/1TwcdCsmseBbTA+QFhE+1TFG7NdWDDBLJ3A7x+LIhYduHokxAxQ97 ShYrpQxQHvz1rTJ/AL0pMreDnBHaF2ckLIUcS3Zbasto9Lsh62iDd/QCaXdncaIOcgPp I2d+6qfaFIfrFLLzR4y+t4k6v+2ihgTg0kG74LCbJHNAdjWgI+1qpJop9cxp6cEBsrG1 tHzAI6cG0lS9BzIW046xFSE6JoMJajimnFc+4NWvOXpij8QKd7tKVw7kn6xVjFRiOx/C c84VwyOx1u1GKEy2pbhQIGJtViCzk4rTocWhLJVDlXZwfDAf4B3rQdf0PQsq0wAG0aHx cU8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Kf6zgkDUnecNfzu3j5XSu5/huKGd/SdarF/Qmk9HXkg=; b=E/j/N3xsUTgs+impT/JTuTRjwcHy1lfIpWWF0VCwTlB6bOeeFLa7Nx8dgCEnuWqc/I nmIepXM15XG/ilE8iiNTr7crSbGfnbPa3/Ckk8IgpmKi5csVHG2levM2p9vapHz8Ib32 6647hXJC+zdGb3zOwltPEhciMqoVA6j9nv30awq3JlE6F4zqznFeM9xRDuzgo/38taX4 3XxIMrzMNUBXtbTPRc8Wl/PU0c2HRFF9SWiOCyhzw/IgCV+fBRT4CuJIDYxpCV0/HScI RdIwCw2QHNMnHdFm998wUCKiv7dsWO+ITrFmKeVT4A76qHZaVdxjUJ7lvLxOB4itWKfN bwQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZgToFv6k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o10-20020aa7c50a000000b005149c18e773si8474354edq.399.2023.06.13.23.34.00; Tue, 13 Jun 2023 23:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZgToFv6k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243162AbjFNGbJ (ORCPT + 99 others); Wed, 14 Jun 2023 02:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243154AbjFNGal (ORCPT ); Wed, 14 Jun 2023 02:30:41 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 701421FCC for ; Tue, 13 Jun 2023 23:30:22 -0700 (PDT) X-GND-Sasl: miquel.raynal@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686724220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kf6zgkDUnecNfzu3j5XSu5/huKGd/SdarF/Qmk9HXkg=; b=ZgToFv6kXV0KhJSTl92ii6RlUbRLDMkIf2OuYuvSLGVaebwUuK5+kRvMfry1Rcq2lIj8Ot AmilI1hLbUuCrTC/xguPSLN5yJOM5WhMA0t0LL/LtaIVkR6/kyhk4lcSA8ILjkigNwP2Mh dTLbaKcRRnnfzhsIpLI1NfP81x8bXVc3dDmV3G0RoaGcpyM4AuUz5smiDioeHngUjqL2UL sgHvPHHZQKImn5RxxXLQhlZnUCqlrPO+mx/YaaALv0e5Zb2yon35hK33cXYMuwt6IXmkkm nt5rfa1vK19j5oO300bAmg6D2aFMP8/cvWu0I9+KIBTg4jLfN6Bi3yEBKAmCpg== X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 144CFFF806; Wed, 14 Jun 2023 06:30:19 +0000 (UTC) From: Miquel Raynal To: Srinivas Kandagatla Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , , Thomas Petazzoni , Luka Perkov , Robert Marko , Miquel Raynal Subject: [PATCH v4 1/4] sysfs: Improve readability by following the kernel coding style Date: Wed, 14 Jun 2023 08:30:15 +0200 Message-Id: <20230614063018.2419043-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230614063018.2419043-1-miquel.raynal@bootlin.com> References: <20230614063018.2419043-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768658795259987309?= X-GMAIL-MSGID: =?utf-8?q?1768658795259987309?= The purpose of the if/else block is to select the right sysfs directory entry to be used for the files creation. At a first look when you have the file in front of you, it really seems like the "create_files()" lines right after the block are badly indented and the "else" does not guard. In practice the code is correct but lacks curly brackets to show where the big if/else block actually ends. Add these brackets to comply with the current kernel coding style and to ease the understanding of the whole logic. Signed-off-by: Miquel Raynal --- fs/sysfs/group.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index eeb0e3099421..990309132c93 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -142,8 +142,10 @@ static int internal_create_group(struct kobject *kobj, int update, return PTR_ERR(kn); } } - } else + } else { kn = kobj->sd; + } + kernfs_get(kn); error = create_files(kn, kobj, uid, gid, grp, update); if (error) {