Commit 61fb1adc authored by Javier Carrasco's avatar Javier Carrasco Committed by Wentao Guan
Browse files

pinctrl: samsung: fix fwnode refcount cleanup if platform_get_irq_optional() fails

stable inclusion
from stable-v6.6.78
commit 0228e5a6672dcf1f29ec1caf396466c28432dfa0
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBX1M5

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0228e5a6672dcf1f29ec1caf396466c28432dfa0



--------------------------------

commit 459915f55509f4bfd6076daa1428e28490ddee3b upstream.

Commit 50ebd19e ("pinctrl: samsung: drop pin banks references on
error paths") fixed the pin bank references on the error paths of the
probe function, but there is still an error path where this is not done.

If samsung_pinctrl_get_soc_data() does not fail, the child references
will have acquired, and they will need to be released in the error path
of platform_get_irq_optional(), as it is done in the following error
paths within the probe function.

Replace the direct return in the error path with a goto instruction to
the cleanup function.

Cc: stable@vger.kernel.org
Fixes: a382d568 ("pinctrl: samsung: Use platform_get_irq_optional() to get the interrupt")
Signed-off-by: default avatarJavier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241106-samsung-pinctrl-put-v1-1-de854e26dd03@gmail.com


[krzysztof: change Fixes SHA to point to commit introducing the return
 leading to OF node leak]
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0228e5a6672dcf1f29ec1caf396466c28432dfa0)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 1f31fad9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1150,7 +1150,7 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)

	ret = platform_get_irq_optional(pdev, 0);
	if (ret < 0 && ret != -ENXIO)
		return ret;
		goto err_put_banks;
	if (ret > 0)
		drvdata->irq = ret;