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
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
Yuuoniy authored and dtor committed May 17, 2022
1 parent ec648fc commit c8994b3
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 c8994b3

Please sign in to comment.