Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp646532rdb; Mon, 15 Jan 2024 08:55:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9PwpeBVZPE3tWicmYTAI4A847Yxu8NFi+zZamwiSgMrzh1W5QLb5CMN6PEjneFkP10Ooe X-Received: by 2002:a05:6a20:ca9:b0:199:dad4:599a with SMTP id dt41-20020a056a200ca900b00199dad4599amr5001789pzb.93.1705337718082; Mon, 15 Jan 2024 08:55:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705337718; cv=none; d=google.com; s=arc-20160816; b=1F8waPVsIPtLip33X5jCL/+k5ARiHj4MNPDPaXnJ168Za/+k1IOQ/IyJ5fv7AEg23m GpXcEs4R4441cskexlmqIfd/r/fiZs6i9lEcNbBORmatviK8kGXFH8kdMmZcE+z8OLuP PVPGzbwtCo2kpnAhbeUUshCQcTCMRw2p4/aJKj9AVOnKjDcmROrmLKAWPhqOnNIMHibP dvuNcK/QIl3AQsSSe+ulA0BozVckPFyTM0QlxV+I7agqhf5rI3H78Z2e0Hh53huMEEIc d94UqMbN6zZLqIqrlI/I72SMQEMg+oN9NWDFXNGYb5kQSVUMJtxwJzV6YzMKsVE61O0y Nheg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=UCNjbbRtiRrrLG8qS/Xc9TIQUVtwQUGSg1R0IufXxj4=; fh=4CnqqLAM9BOU+UCNnrIhYOH55eFFZBsbf0ZQjF6otJ8=; b=GT3VVYQ+uBeDIcvQ90MiG3LUZq2LeiH0eUSyf33wLlTScooaLDU94l1yqJy1H8oRui ZUUqgxRSpPd1AZRfNHIR3bOodq/EUopyrb1ncKOVN2Mb025ek5orujElRCQbJSEEzssj 6aguqgYftl2sIIE4iV6Wt8ZSHUOC3N79ZgDtrS/BW3LI3pfxsJi7feQZ07HdOup3DbB7 ZgFOByIf0v6XXA9xfN262clI35w5aI1nK1XrL6/g2rDAHo17DiiZQ7fvduaK5GMqySIo y/uOsOGt3Ge/ZVtCybFcqliBmve2SRKkHd3zagcTCWeJTm+WPuCWmKTsCjrVgPJ+W48D Fl0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QJb0gT1P; spf=pass (google.com: domain of linux-kernel+bounces-26281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26281-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id v26-20020aa7809a000000b006d9bf644e53si8709603pff.353.2024.01.15.08.55.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 08:55:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QJb0gT1P; spf=pass (google.com: domain of linux-kernel+bounces-26281-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26281-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9E7BEB21869 for ; Mon, 15 Jan 2024 16:55:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B219717C63; Mon, 15 Jan 2024 16:55:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QJb0gT1P" Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 721D017BDC for ; Mon, 15 Jan 2024 16:55:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-5f07f9d57b9so86367787b3.1 for ; Mon, 15 Jan 2024 08:55:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705337705; x=1705942505; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=UCNjbbRtiRrrLG8qS/Xc9TIQUVtwQUGSg1R0IufXxj4=; b=QJb0gT1PpLktx/0uPXAcr1WeWa+07jrV9nnunkQxy829tIb24fkSjSrAqC7d8BDDqP ZP273IzDmOHkXUIclucJr+nmBkSPsIw15Im+j9ZUq1HRSJFz6mmhNJNBAFxtbddBTFdm mfifwOBmjUzwgp2foOYetcg6Lc3vXUGaqzBexwb58eMjb/M1gW3TUqg6AayBP1cdFlpr C+w+Op1PofYHTF65SyjNlwqf6vBx2Ym0WDlVfIbblZpHHyVWFQPt5ig/nOpYtRWNpMvL QxxrJDsgizMAYMcltKQHzVsmNhCtbhstOjttiFTQc3c2mj5pfVZNuEE5h0U+PS8gv9if LowA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705337705; x=1705942505; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UCNjbbRtiRrrLG8qS/Xc9TIQUVtwQUGSg1R0IufXxj4=; b=lQ3DlNHbhIl0qDlaZOvWtcx2TWRKzCW3iRx/FqE4RqjOcMOB0hA169cVbvQDkQp2oJ XMtuvHUG/YGy7pG+fHB1LBV5hPJbBCqWVsJk6fDNtFL0l02EFKjMnlB9qmEOf/ww1Zzm NZdpBJ7Gv1DAxPzXvmKGxoYRy8DJJEe/sa+Bls0041iObc8Ti2Yg+YYXmibGxjxVRGCU Q7yw6w/k1GyOtPZDWabiWRGmQEff+sbt3M5V9lARBICs9kvh0+XHguHnIM4JpkPbAaSY qVse3eebEhesena8WOKFx2uuJTDq4noCawsgktsxisr4Drh4FogD1axs7zX1KviTDz5v f+Zw== X-Gm-Message-State: AOJu0YyHNX0B4McutFze2KOWzAxuRNrJS2TN/iZNIEVlOW988b6CdscY B3FLyb+DbFUEPcVIKQ5TMiEdBS+Z30GqZjzSDjO8bVHusWA= X-Received: by 2002:a5b:8c8:0:b0:dbe:a4a2:c942 with SMTP id w8-20020a5b08c8000000b00dbea4a2c942mr2793432ybq.25.1705337705379; Mon, 15 Jan 2024 08:55:05 -0800 (PST) Received: from ?IPV6:2a05:6e02:1041:c10:439d:3bc0:a764:73dc? ([2a05:6e02:1041:c10:439d:3bc0:a764:73dc]) by smtp.googlemail.com with ESMTPSA id d193-20020a25cdca000000b00da082362238sm3703878ybf.0.2024.01.15.08.55.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 08:55:05 -0800 (PST) Message-ID: Date: Mon, 15 Jan 2024 17:55:02 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] thermal/debugfs: Remove unnecessary debugfs_create_dir() error check in thermal_debug_init() Content-Language: en-US To: "Rafael J. Wysocki" , Minjie Du Cc: Zhang Rui , Lukasz Luba , "open list:THERMAL" , open list , opensource.kernel@vivo.com References: <20240115082507.29651-1-duminjie@vivo.com> From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 15/01/2024 16:52, Rafael J. Wysocki wrote: > On Mon, Jan 15, 2024 at 9:25 AM Minjie Du wrote: >> >> This patch removes the debugfs_create_dir() error checking in >> thermal_debug_init(). Because the debugfs_create_dir() is developed >> in a way that the caller can safely handle the errors that >> occur during the creation of DebugFS nodes. > > I honestly don't see what the purpose of this patch is. I think it is because the recent debugfs changes were about to reduce as much as possible the code related to the error handling as the debugfs is not supposed to go in production system. So for instance debugfs_create_dir() will not fail if the parent is NULL and will create the entry in the debugfs topdir. At the end we are ending up with: d_root = debugfs_create_dir("thermal", NULL); d_cdev = debugfs_create_dir("cooling_devices", d_root); d_tz = debugfs_create_dir("thermal_zones", d_root); The current code will avoid creating lost entries in /sys/kernel/debug The proposed change will create those in /sys/kernel/debug in case of error. Note I reduced as much as possible the error handling in this function. So it is a matter to reduce it even more but may be resulting in junk in /sys/kernel/debug in case of error TBH, I'm 50/50 :) >> Signed-off-by: Minjie Du >> --- >> drivers/thermal/thermal_debugfs.c | 4 ---- >> 1 file changed, 4 deletions(-) >> >> diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c >> index a3fa09235da1..695253559a61 100644 >> --- a/drivers/thermal/thermal_debugfs.c >> +++ b/drivers/thermal/thermal_debugfs.c >> @@ -172,12 +172,8 @@ struct thermal_debugfs { >> void thermal_debug_init(void) >> { >> d_root = debugfs_create_dir("thermal", NULL); >> - if (!d_root) >> - return; >> >> d_cdev = debugfs_create_dir("cooling_devices", d_root); >> - if (!d_cdev) >> - return; >> >> d_tz = debugfs_create_dir("thermal_zones", d_root); >> } >> -- -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog