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 17DA81EB9E9; Tue, 15 Oct 2024 11:43:16 +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=1728992596; cv=none; b=Zg8UJLT9loEF5Evtded6F4QC4HfaoNV5Z1IPLmI/eOaDGOWt84ZkfrkxQ8mTPadY4FUI7Vd3uX5gzhRqhStK0UyH68lbdv2vgqYOXS5jV1KTgj7uxlSxRDTXr9psFSbWyWXZIdHnTaY3VZzLZ54jVHyPQ2H8WZ8WSIcYTK0oL5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728992596; c=relaxed/simple; bh=6TlgwAJdjFGKrp+PJYeYhs4GRJE283wmsHQpMtiYYBE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=miPrvGD1CBsEpYkFcM0LeYRMfgb7PwSz+Cf2B9wKwBZiXz0UmlN8+5YO3Sez8OLcmbI2QjV45ed5IwFpB6ONo0cROqnnJ5q4B1eaDpSI33cCfE5MWOPkLLqZ9XpHpQAmg0Fkw3djziUKoVp7BJ7X3fP5fAyVCO+qaBjEYNI1tWw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zjLSG6Fw; 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="zjLSG6Fw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CB46C4CEC6; Tue, 15 Oct 2024 11:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728992596; bh=6TlgwAJdjFGKrp+PJYeYhs4GRJE283wmsHQpMtiYYBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zjLSG6FwctQFMnxrS0Q8xRxoPUREr7u2JAdIJI4HFtOVRERhRtQ4dUJJ3S8s4kiHF ikn/D6ERCV9KkYyEBqlZSpgHVU8yJQm6NMlPU96nMazNA4135kGs24BWscUJV0kmUW 5bGqv8WPzqw/hCORwna6gjwbqsOmZ0wZPI5X2asw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Krzysztof Kozlowski , Damien Le Moal , Philipp Zabel , Sasha Levin Subject: [PATCH 5.15 145/691] reset: berlin: fix OF node leak in probe() error path Date: Tue, 15 Oct 2024 13:21:33 +0200 Message-ID: <20241015112446.110374736@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015112440.309539031@linuxfoundation.org> References: <20241015112440.309539031@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Krzysztof Kozlowski [ Upstream commit 5f58a88cc91075be38cec69b7cb70aaa4ba69e8b ] Driver is leaking OF node reference on memory allocation failure. Acquire the OF node reference after memory allocation to fix this and keep it simple. Fixes: aed6f3cadc86 ("reset: berlin: convert to a platform driver") Signed-off-by: Krzysztof Kozlowski Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20240825-reset-cleanup-scoped-v1-1-03f6d834f8c0@linaro.org Signed-off-by: Philipp Zabel Signed-off-by: Sasha Levin --- drivers/reset/reset-berlin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/reset/reset-berlin.c b/drivers/reset/reset-berlin.c index 2537ec05eceef..578fe867080ce 100644 --- a/drivers/reset/reset-berlin.c +++ b/drivers/reset/reset-berlin.c @@ -68,13 +68,14 @@ static int berlin_reset_xlate(struct reset_controller_dev *rcdev, static int berlin2_reset_probe(struct platform_device *pdev) { - struct device_node *parent_np = of_get_parent(pdev->dev.of_node); + struct device_node *parent_np; struct berlin_reset_priv *priv; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; + parent_np = of_get_parent(pdev->dev.of_node); priv->regmap = syscon_node_to_regmap(parent_np); of_node_put(parent_np); if (IS_ERR(priv->regmap)) -- 2.43.0