]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: bcm2835: Do not call gpiod_put() on invalid descriptor
authorFlorian Fainelli <florian.fainelli@broadcom.com>
Tue, 1 Apr 2025 22:42:38 +0000 (15:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:39:33 +0000 (14:39 +0200)
commit48b175aa4677498268c50cb5eaaea11650ce805d
tree4332aee72650f320bdf19ad193789f9151067bc3
parent4d8458e48ff135bddc402ad79821dc058ea163d0
spi: bcm2835: Do not call gpiod_put() on invalid descriptor

[ Upstream commit d6691010523fe1016f482a1e1defcc6289eeea48 ]

If we are unable to lookup the chip-select GPIO, the error path will
call bcm2835_spi_cleanup() which unconditionally calls gpiod_put() on
the cs->gpio variable which we just determined was invalid.

Fixes: 21f252cd29f0 ("spi: bcm2835: reduce the abuse of the GPIO API")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20250401224238.2854256-1-florian.fainelli@broadcom.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-bcm2835.c