media: platform: exynos4-is: Fix an OF node reference leak in fimc_md_is_isp_available

In fimc_md_is_isp_available(), of_get_child_by_name() is called to check
if FIMC-IS is available. Current code does not decrement the refcount of
the returned device node, which causes an OF node reference leak. Fix it
by calling of_node_put() at the end of the variable scope.

Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Fixes: e781bbe3fe ("[media] exynos4-is: Add fimc-is subdevs registration")
Cc: stable@vger.kernel.org
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: added CC to stable]
This commit is contained in:
Joe Hattori 2024-11-04 19:01:19 +09:00 committed by Hans Verkuil
parent 69df1f89db
commit 8964eb2340

View File

@ -178,8 +178,9 @@ int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on);
#ifdef CONFIG_OF
static inline bool fimc_md_is_isp_available(struct device_node *node)
{
node = of_get_child_by_name(node, FIMC_IS_OF_NODE_NAME);
return node ? of_device_is_available(node) : false;
struct device_node *child __free(device_node) =
of_get_child_by_name(node, FIMC_IS_OF_NODE_NAME);
return child ? of_device_is_available(child) : false;
}
#else
#define fimc_md_is_isp_available(node) (false)