Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp479798pxb; Wed, 3 Mar 2021 07:57:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYInrbRO38qLhYpmlfT2x0JUp9XA+xWpPk3rAp9KdXfWDp0luX52dnub41zUD3bJ9QvR0Q X-Received: by 2002:a17:906:f953:: with SMTP id ld19mr3154094ejb.164.1614787022549; Wed, 03 Mar 2021 07:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614787022; cv=none; d=google.com; s=arc-20160816; b=swx4Jj+T0/opG1mUqIEwwR7WA5P3VLt6fjSQ+Ephi1TGqQGMcz8ILVDVW0/58IMKyL +5+n2xH1aJvz3vhqGN/LDfwPWatJYdVJS3iKWTIjQ1R0mBqDte8u+zY6vX48qdoypAyK MivXdR1uHAJdJY5JhdatCl3yvVs9lMlS4jzGxanYGg+amAe/k0jnDAni0q+3kfVIOuji z3jDltXR9PCoqwOGkDz2VQxMVsrYCwdgtdGv+M0L2nxRZnmMmlnEGVsQ2w0aYBuAvpUa EquYfHQO8CfZBJHFGoMJCT0FQIl7bB/n4nVzdFg00uDVH8MqeGGejIjD1mLT0PwoZxMQ fxCA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qDw3qf+lxYJ7VKE8ZO6U4Wy2skmANe99G6KwoOJptc0=; b=folZmQ9UFbDsNGBloIx+7+UEQXaMbwrTCawv7iyRI1hHx2TBpkA/qtT4GZ+RDyF4cE s1lTc8cy1RhYeiVMobR0MwqVHsXQHp0N9QdSzOZfl+mZBrEdOrFJGQIkbu+aVxiD31GI oV4p3SIUTolVIdWW8QADCKYyCQFyxodEbIsni2CbocmxfHI+Hc1X36rK7t9MFyAC/o5b y1CenLOMv3tmoBaxUy3HYN4U1KM4VY+ElvxnqlBYWKQ8nWjyK1yIQUFRxtcFC4b8IIOw OITSqnnRkVE/I/Bl919s8GLQJfWDaLpYFWLoZ3TBs+0mE1ft1o75TpgRIOIC0HPop2tD 4Eag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mT3HilH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si16012315ejv.446.2021.03.03.07.56.01; Wed, 03 Mar 2021 07:57:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mT3HilH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345832AbhCAXdy (ORCPT + 99 others); Mon, 1 Mar 2021 18:33:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:58286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239088AbhCASFp (ORCPT ); Mon, 1 Mar 2021 13:05:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 686F4651D4; Mon, 1 Mar 2021 17:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619051; bh=pItgVztPsWOLbhu1XQT65dKNDo2XiajdX3r/DX5pCk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mT3HilH90EHo6oGl79kNoH8IDZ48bh2xbgShimNC2Bkg3nPRRxsRUgGUCrxvlSQz3 Uj67XF9el9HT425QJOluBlComvy6Ph+uwsx9s/wpi/tE51wuu198LgOGUYAv+JuRiA GkPQNNP3TN+GQLfeHIinPVrhTLCn7co0dbe3WRek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Hans de Goede , Mark Brown , Sasha Levin Subject: [PATCH 5.10 314/663] regulator: core: Avoid debugfs: Directory ... already present! error Date: Mon, 1 Mar 2021 17:09:22 +0100 Message-Id: <20210301161157.381011644@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit dbe954d8f1635f949a1d9a5d6e6fb749ae022b47 ] Sometimes regulator_get() gets called twice for the same supply on the same device. This may happen e.g. when a framework / library is used which uses the regulator; and the driver itself also needs to enable the regulator in some cases where the framework will not enable it. Commit ff268b56ce8c ("regulator: core: Don't spew backtraces on duplicate sysfs") already takes care of the backtrace which would trigger when creating a duplicate consumer symlink under /sys/class/regulator/regulator.%d in this scenario. Commit c33d442328f5 ("debugfs: make error message a bit more verbose") causes a new error to get logged in this scenario: [ 26.938425] debugfs: Directory 'wm5102-codec-MICVDD' with parent 'spi-WM510204:00-MICVDD' already present! There is no _nowarn variant of debugfs_create_dir(), but we can detect and avoid this problem by checking the return value of the earlier sysfs_create_link_nowarn() call. Add a check for the earlier sysfs_create_link_nowarn() failing with -EEXIST and skip the debugfs_create_dir() call in that case, avoiding this error getting logged. Fixes: c33d442328f5 ("debugfs: make error message a bit more verbose") Cc: Charles Keepax Signed-off-by: Hans de Goede Reviewed-by: Charles Keepax Link: https://lore.kernel.org/r/20210122183250.370571-1-hdegoede@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 35098dbd32a3c..7b3de8b0b1caf 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1617,7 +1617,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, const char *supply_name) { struct regulator *regulator; - int err; + int err = 0; if (dev) { char buf[REG_STR_SIZE]; @@ -1663,8 +1663,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, } } - regulator->debugfs = debugfs_create_dir(supply_name, - rdev->debugfs); + if (err != -EEXIST) + regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs); if (!regulator->debugfs) { rdev_dbg(rdev, "Failed to create debugfs directory\n"); } else { -- 2.27.0