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 4717B35A95C; Fri, 9 Jan 2026 12:30:54 +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=1767961854; cv=none; b=THpw4RJqlfOppG4d/0wVQSjwnMzLGjFv0L0ggom6eeB9CiRlRFiTtJA4EpbjzPsxQb2q0UAWtU1n91oxUW6i6V99uUMY5ULCBDeX81HkerTFBJBmjudEp6Sg8xdCzb64G5m60aoQqju6FwcwUBbZp3rAd8Esto8L+8EsyvdP9/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767961854; c=relaxed/simple; bh=PQU1Z9LLqszX5g378NBfw4ySGnJ7oPM149LYONSeGJU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jiZzkhgbOwo/44PpldpBKlpEgxHcGHLdUl4IHU66DeFW6eQCvid6lUoRnnXmmuJ2epEALERGSBfyJ3nLczKfumNj8V9Stvw21/JBGcKQYpEoeGq8cylV1wv837tvn6Wod8y8BqSkRjN672oNMcbkgaij3Ih/ormKxmvY+cQWlQg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xBk5gfZ2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xBk5gfZ2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6315C4CEF1; Fri, 9 Jan 2026 12:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767961854; bh=PQU1Z9LLqszX5g378NBfw4ySGnJ7oPM149LYONSeGJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xBk5gfZ2OxZOXdJJfa/uCW/MKxVLhb1MYdQLdQjeJjhgYHXAS9tuVle1KPzch99X2 mo13j1/hfrwZpT2DFG4K8XWjKw2qllS5TqZW9bBbW3Lwlo/zhU6w7Az2qURz6cbMtc 88C6JQORuJk5cfW5SNM/HmYpJmCCcrvCDIHCDYRI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guenter Roeck , Haotian Zhang , Sasha Levin Subject: [PATCH 6.1 159/634] hwmon: sy7636a: Fix regulator_enable resource leak on error path Date: Fri, 9 Jan 2026 12:37:17 +0100 Message-ID: <20260109112123.434098792@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109112117.407257400@linuxfoundation.org> References: <20260109112117.407257400@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haotian Zhang [ Upstream commit 2f88425ef590b7fcc2324334b342e048edc144a9 ] In sy7636a_sensor_probe(), regulator_enable() is called but if devm_hwmon_device_register_with_info() fails, the function returns without calling regulator_disable(), leaving the regulator enabled and leaking the reference count. Switch to devm_regulator_get_enable() to automatically manage the regulator resource. Fixes: de34a4053250 ("hwmon: sy7636a: Add temperature driver for sy7636a") Suggested-by: Guenter Roeck Signed-off-by: Haotian Zhang Link: https://lore.kernel.org/r/20251126162602.2086-1-vulab@iscas.ac.cn Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/sy7636a-hwmon.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c index 9fabd60e9a970..73d958de485d8 100644 --- a/drivers/hwmon/sy7636a-hwmon.c +++ b/drivers/hwmon/sy7636a-hwmon.c @@ -66,18 +66,13 @@ static const struct hwmon_chip_info sy7636a_chip_info = { static int sy7636a_sensor_probe(struct platform_device *pdev) { struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL); - struct regulator *regulator; struct device *hwmon_dev; int err; if (!regmap) return -EPROBE_DEFER; - regulator = devm_regulator_get(&pdev->dev, "vcom"); - if (IS_ERR(regulator)) - return PTR_ERR(regulator); - - err = regulator_enable(regulator); + err = devm_regulator_get_enable(&pdev->dev, "vcom"); if (err) return err; -- 2.51.0