Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1162754lqo; Thu, 9 May 2024 06:35:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuEzBbcChijmQ2p5i8LZfc2CrLzWQdiHBbUIRjsb93+q78JRrnSGBQSei/kiO5K86IDEYiU9hAGGmIhqSByugu6hBxYXE/KJEgRVsdCw== X-Google-Smtp-Source: AGHT+IHT87PDtpGUX5/jaeo0aP8CDVdGiIcDeHgfrHHBfARDk6cn2u19rIzv2OsDOoXxj0o+xp2d X-Received: by 2002:a17:902:bcc1:b0:1e2:bdef:3971 with SMTP id d9443c01a7336-1eefa13a03dmr33256585ad.16.1715261715968; Thu, 09 May 2024 06:35:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715261715; cv=pass; d=google.com; s=arc-20160816; b=jtCuQF0SCyev5dl31a0TNk1W+3cA7Ima9JMhpRWFBfWVNkHBLw7XFa1YIHZQaeJUME R2XSS9185mEP3k4uSU8c3yU55his8O8Yqk5ZEcFK7LPSg4HbacvxYN3jfo0GVBtZiUy7 9wNYY3SLcwrenO8JGIp4LwWZYvjueT+UFdnJzjraXRDe/hFN2Dx4n3ri3Apb+WY5565d uI5wNHVXzzd8FhK7tY2a6Rk/0e7NYi3fhCmTZsQrA4qmbN3BLXxl5N9tbBSFa0yMkRVM MBPjAO2QGrPh5ZEGi1hhh9RdlLVaMhpr+ISY7m0KNRduRqyuqr/zQfvHtAj4N+LUAvCM asHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=H83fACdwAQeEarVIbeQ2rQDCAJNWyNnSq6d2mG2iU1Q=; fh=BK6X/25UOhv9KI5oIL4iht2SAFDZ3nH4r1m+PJfPlp4=; b=tSfjy5d9ZuAXOtmwDcsnYChIIEB18ZCqwX+0Vq4sSnfSUlbvVuNsytsVh+LeoSKppV 5cYB01pO+03pIEHgQOg4H35f6o/e3QEnzeswZhkv6jjHuU9WX/zci2O+2PKpyD6SxH0K NvgWU+FpeB7Do9IIaMa3TF6LBMtwYy70NNGub+Rvw7bQaDqxhnnHkOzxJZqb33w9FExZ 200369dbY8M4a9OY9txen1uzvfiEJW3QCwgNLXEcx50HKynIrqUjL27to3ULP8ONppwb /4+BCCs3wp/yOgEqVXnpo7PdMqDToSRLkUktV3iSu5xwokwcRy/fJZ5yos56hZ/K+qXk aP4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ujzz7B1i; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 d9443c01a7336-1ef0b9cf66dsi15155015ad.65.2024.05.09.06.35.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 06:35:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174543-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=@kernel.org header.s=k20201202 header.b=ujzz7B1i; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-174543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 25BB3B23AA6 for ; Thu, 9 May 2024 13:34:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEE991527BF; Thu, 9 May 2024 13:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ujzz7B1i" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDBA814A62A; Thu, 9 May 2024 13:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715261643; cv=none; b=WjCgWYCPILHoTdgOSHYEJTRgf+eVJZJRolgRqbizb4b7CDFfX57pmQbozfBKAtTNyDhVlhaKU9eTk72O4d6ZcEy33Zdu0BQLALrkC6DE5asDQfDQ3VnFilAEV+IRVSR+ZOnGh2mvYJO8X23zYc0KvM5BOGYS/btBSIc9uPIlFqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715261643; c=relaxed/simple; bh=2+YHYFlsCfhJDdkXDf1ER0vd6Y27waqfJtG7Kf2YXBo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AYtAMeiHSjg4S/ma0novLnBr0z3ySryHjYe9db2ujrixAX/TJjsW8yPtt1AcX0L2M41v9PB6BtR52NinY8va7nVkjdw4yrtNuWAvPg5rjweZlr8MOED4dvIiyS/vhqfkzzLNDuqhxbvtyKIDzWCpDDGvKWGnYcoyKvIjuqB+k9I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ujzz7B1i; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F104C116B1; Thu, 9 May 2024 13:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715261643; bh=2+YHYFlsCfhJDdkXDf1ER0vd6Y27waqfJtG7Kf2YXBo=; h=From:To:Cc:Subject:Date:From; b=ujzz7B1i+33eE8tAYa7zkh51+XgGAs/n39T/ILyKsvJwAIofrrPBIaQHDjrFROHOc tnYWwWBeVd56IS9J06SiiOSuaAwPc+HKff8RXp07BmRkYBeXxMMYwYWaPLWge8R6BO Tp/xDL0EFFPMRXT1TSEUwu9OZG5+0/lMeb/ZdoW6yCzcIfmLatL+rTNcURF7DhcdQT ADvte6L8om6PgP5bP6t8N3w4CB6AOXA9JfqEpM9UzGm4Xway828Zj7zQMNU7gJpj2E NPFfkVilMGvrKU92Cgooqjmutj/WizB/SFBrKTYI33YytbAz8vk5zUZ5z1AxXEdCKG OnUzgndFe/eVg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s53uR-000000002Ko-0fMi; Thu, 09 May 2024 15:34:07 +0200 From: Johan Hovold To: Mark Brown Cc: Liam Girdwood , linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] regulator: core: fix debugfs creation regression Date: Thu, 9 May 2024 15:33:04 +0200 Message-ID: <20240509133304.8883-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit regulator_get() may sometimes be called more than once for the same consumer device, something which before commit dbe954d8f163 ("regulator: core: Avoid debugfs: Directory ... already present! error") resulted in errors being logged. A couple of recent commits broke the handling of such cases so that attributes are now erroneously created in the debugfs root directory the second time a regulator is requested and the log is filled with errors like: debugfs: File 'uA_load' in directory '/' already present! debugfs: File 'min_uV' in directory '/' already present! debugfs: File 'max_uV' in directory '/' already present! debugfs: File 'constraint_flags' in directory '/' already present! on any further calls. Fixes: 2715bb11cfff ("regulator: core: Fix more error checking for debugfs_create_dir()") Fixes: 08880713ceec ("regulator: core: Streamline debugfs operations") Cc: stable@vger.kernel.org Cc: Geert Uytterhoeven Signed-off-by: Johan Hovold --- drivers/regulator/core.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index dabac9772741..2c33653ffdea 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1911,19 +1911,24 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, } } - if (err != -EEXIST) + if (err != -EEXIST) { regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs); - if (IS_ERR(regulator->debugfs)) - rdev_dbg(rdev, "Failed to create debugfs directory\n"); + if (IS_ERR(regulator->debugfs)) { + rdev_dbg(rdev, "Failed to create debugfs directory\n"); + regulator->debugfs = NULL; + } + } - debugfs_create_u32("uA_load", 0444, regulator->debugfs, - ®ulator->uA_load); - debugfs_create_u32("min_uV", 0444, regulator->debugfs, - ®ulator->voltage[PM_SUSPEND_ON].min_uV); - debugfs_create_u32("max_uV", 0444, regulator->debugfs, - ®ulator->voltage[PM_SUSPEND_ON].max_uV); - debugfs_create_file("constraint_flags", 0444, regulator->debugfs, - regulator, &constraint_flags_fops); + if (regulator->debugfs) { + debugfs_create_u32("uA_load", 0444, regulator->debugfs, + ®ulator->uA_load); + debugfs_create_u32("min_uV", 0444, regulator->debugfs, + ®ulator->voltage[PM_SUSPEND_ON].min_uV); + debugfs_create_u32("max_uV", 0444, regulator->debugfs, + ®ulator->voltage[PM_SUSPEND_ON].max_uV); + debugfs_create_file("constraint_flags", 0444, regulator->debugfs, + regulator, &constraint_flags_fops); + } /* * Check now if the regulator is an always on regulator - if -- 2.43.2