mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-17 22:59:37 +02:00
reset: berlin: fix OF node leak in probe() error path
[ Upstream commit5f58a88cc9
] 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:aed6f3cadc
("reset: berlin: convert to a platform driver") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20240825-reset-cleanup-scoped-v1-1-03f6d834f8c0@linaro.org Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b2cce50abd
commit
cfbf049d16
|
@ -68,13 +68,14 @@ static int berlin_reset_xlate(struct reset_controller_dev *rcdev,
|
||||||
|
|
||||||
static int berlin2_reset_probe(struct platform_device *pdev)
|
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;
|
struct berlin_reset_priv *priv;
|
||||||
|
|
||||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
parent_np = of_get_parent(pdev->dev.of_node);
|
||||||
priv->regmap = syscon_node_to_regmap(parent_np);
|
priv->regmap = syscon_node_to_regmap(parent_np);
|
||||||
of_node_put(parent_np);
|
of_node_put(parent_np);
|
||||||
if (IS_ERR(priv->regmap))
|
if (IS_ERR(priv->regmap))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user