Skip to content

Commit

Permalink
Input: sparcspkr - fix refcount leak in bbc_beep_probe
Browse files Browse the repository at this point in the history
[ Upstream commit c8994b3 ]

of_find_node_by_path() calls of_find_node_opts_by_path(),
which returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 9c1a507 ("input: Rewrite sparcspkr device probing.")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220516081018.42728-1-linmq006@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yuuoniy authored and gregkh committed Jun 9, 2022
1 parent 76badb0 commit 6e07ccc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/input/misc/sparcspkr.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ static int bbc_beep_probe(struct platform_device *op)

info = &state->u.bbc;
info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0);
of_node_put(dp);
if (!info->clock_freq)
goto out_free;

Expand Down

0 comments on commit 6e07ccc

Please sign in to comment.