leds: led-core: Fix refcount leak in of_led_get()
authorMiaoqian Lin <linmq006@gmail.com>
Tue, 20 Dec 2022 12:18:07 +0000 (16:18 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:32 +0000 (09:39 +0100)
commit690efcb5827c3bacbf1de90cd14907b91bf8cb7b
treeef1c883c47dfb814c3e8d27589d1f6bcc02e00dd
parent1cdf973d2b3aced0e1912b11e77ad9325ba8a80b
leds: led-core: Fix refcount leak in of_led_get()

[ Upstream commit da1afe8e6099980fe1e2fd7436dca284af9d3f29 ]

class_find_device_by_of_node() calls class_find_device(), it will take
the reference, use the put_device() to drop the reference when not need
anymore.

Fixes: 699a8c7c4bd3 ("leds: Add of_led_get() and led_put()")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20221220121807.1543790-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/leds/led-class.c