]> git.baikalelectronics.ru Git - kernel.git/commit
firmware: raspberrypi: Keep count of all consumers
authorNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Mon, 18 Jan 2021 12:32:34 +0000 (13:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:52 +0000 (11:35 +0200)
commit2150562c8d5f27717a7971c7d798abd1b084010f
tree930c108fd784ac016f34e9183775a6c35e0cdba2
parent939ac8b70212efa788f9bffc6e59913f7597d88f
firmware: raspberrypi: Keep count of all consumers

[ Upstream commit 2284abf319f53ec0e516680a16cff072ad160da3 ]

When unbinding the firmware device we need to make sure it has no
consumers left. Otherwise we'd leave them with a firmware handle
pointing at freed memory.

Keep a reference count of all consumers and introduce rpi_firmware_put()
which will permit automatically decrease the reference count upon
unbinding consumer drivers.

Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Stable-dep-of: 5bca3688bdbc ("Input: raspberrypi-ts - fix refcount leak in rpi_ts_probe")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/raspberrypi.c
include/soc/bcm2835/raspberrypi-firmware.h