From mboxrd@z Thu Jan 1 00:00:00 1970 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 6E21B1ED4F for ; Tue, 25 Jul 2023 11:37:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3B5EC433C7; Tue, 25 Jul 2023 11:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690285044; bh=GREl4/7S7HK+iMPET4QlYYY1ghvyhp3uZfnFzPdvFOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lIxPlCGUHvsNWG9WO0k/hZZjjadHtrX2nkgPLPZLj5Xa3FUYpqfrCLDekeljlJ+3X uPEFpO65xcyLiAorYbDVMJg2MBMhiSF0G/5IGkqbyqd5YWS7OllTZtc8kR35kCOjtE mbMWc641Zv6jJb+9McxU7l7M2VfGOEwoL/drXrY8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Geert Uytterhoeven , Mark Brown , Sasha Levin Subject: [PATCH 5.4 035/313] regulator: core: Fix more error checking for debugfs_create_dir() Date: Tue, 25 Jul 2023 12:43:08 +0200 Message-ID: <20230725104522.599571651@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104521.167250627@linuxfoundation.org> References: <20230725104521.167250627@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Geert Uytterhoeven [ Upstream commit 2715bb11cfff964aa33946847f9527cfbd4874f5 ] In case of failure, debugfs_create_dir() does not return NULL, but an error pointer. Most incorrect error checks were fixed, but the one in create_regulator() was forgotten. Fix the remaining error check. Fixes: 2bf1c45be3b8f3a3 ("regulator: Fix error checking for debugfs_create_dir") Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/ee980a108b5854dd8ce3630f8f673e784e057d17.1685013051.git.geert+renesas@glider.be Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index cc9aa95d69691..0ac9c763942f9 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1710,7 +1710,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, if (err != -EEXIST) regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs); - if (!regulator->debugfs) { + if (IS_ERR(regulator->debugfs)) { rdev_dbg(rdev, "Failed to create debugfs directory\n"); } else { debugfs_create_u32("uA_load", 0444, regulator->debugfs, -- 2.39.2