From patchwork Mon Jun 5 13:34:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 103276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2710671vqr; Mon, 5 Jun 2023 07:07:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MPKLMr6/AXMTjEPaMiN9PCgrht3Go9fl6gqCS7svKqJF9HSeE5NlZTdHHK7sLNpc5tsPA X-Received: by 2002:a17:902:c206:b0:1b0:122f:672b with SMTP id 6-20020a170902c20600b001b0122f672bmr7492477pll.47.1685974025331; Mon, 05 Jun 2023 07:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685974025; cv=none; d=google.com; s=arc-20160816; b=mR+QRREhP9LBvjkYZAPahJE5W2GADKHUPaRhYPqc1E6WfEQKGFAbBPrgTO5lzH3RlJ /f63qCvnQQWKo3mXu0jwFyVoEDaBuQrmQNWxseoS3Io3CwC1sg3sXURHEPULEL24V+Zg 2+t+f5mVDastR+0qCwbL++crOXzoRsQ8/HLNFKj1mTyGYcoKthpDxYHHXUf8RBNc01A2 auJp3VhAfxNKNUsMewSnR83djamAgiCjKXDB3xUoeSwiFdYMLjSw2aJZiM6x1dB0QTF4 MgeCzcDDqnnc4cgvaETaebvlNI2o/2OA4LRXtCQtzKfE4Q0jcX3v2NowvBziWMU+lAWV Rmyg== 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=oDQJSXYuEx9lNEQf+DMXwQITwwv9AMC5AJhsx/UzkzMjfoiHRDuNC8wcRi1nnn6Xo3 nQ3Bhg6vJdogwcg49MRfUeQRe4f7PV8ry4Od0AootDKYwbZpCXYhUhGoKZPYcsGSuHBP BVGCcdRSdxPwZrRdczT04SxXGmJj0nczesnOsFw7a8OvVApJC2zGt3YU2NXwLffV8Ry8 UvTESxoG8M/s4O2J6XtQa3fE0fp49N4OFE4b1LklHt3GL/bYD9/tPtlsnUcU5X8udOoQ ttW07w1LU/4VeEUyPd/spZcUvXKKc1gBG8m0OvJIBbo6gug9fQNZF2fzBfUSY6lSjvwk ovAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=e3vzuYc+; 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 a2-20020a170902ecc200b001b045d65aedsi5646299plh.228.2023.06.05.07.06.52; Mon, 05 Jun 2023 07:07:05 -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=e3vzuYc+; 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 S229815AbjFENeb (ORCPT + 99 others); Mon, 5 Jun 2023 09:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231370AbjFENe1 (ORCPT ); Mon, 5 Jun 2023 09:34:27 -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 EE1D8DB for ; Mon, 5 Jun 2023 06:34:25 -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=1685972064; 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=e3vzuYc+FQS4U26zWHOa1Nuw6wzI+Q4pu2QiWAwmFJXBtt41NvtzYC1g475fXEc3IgpvJw 8aUqcvLqwYSmAynnaUt/sHuvpppFiaCQzZj0lRYQTsVRz0jSFIYiCLVMsnZsquD3tbVbnd AKBla+3BywAN+pzMNKc+XyRR7WKQ85MGhQLX+aJKceuDSC0MlKHcfAQrG9LMLEI5HeHcWj bcB+XNWPssl6VnooV+EqkYBphWXFuj0Xz0nTp24ClEa6dN0bHzuTaQ/nBCwkbufGB6iWmX JRj0kBUsmLHWdPTDc6DzKYfhKMYyzNZXYhy1PsmJZgUNhgVLzE7pPjq95qi7Yw== 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 A553DFF80D; Mon, 5 Jun 2023 13:34:23 +0000 (UTC) From: Miquel Raynal To: Greg Kroah-Hartman Cc: Luka Perkov , Robert Marko , Thomas Petazzoni , , Srinivas Kandagatla , Rafael J Wysocki , Miquel Raynal Subject: [PATCH v3 1/4] sysfs: Improve readability by following the kernel coding style Date: Mon, 5 Jun 2023 15:34:19 +0200 Message-Id: <20230605133422.45840-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605133422.45840-1-miquel.raynal@bootlin.com> References: <20230605133422.45840-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 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?1767871899644022783?= X-GMAIL-MSGID: =?utf-8?q?1767871899644022783?= 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) {