]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mtd: rawnand: lpc32xx_slc: fix GPIO descriptor leak on probe error and remove
authorHaotian Zhang <vulab@iscas.ac.cn>
Tue, 28 Oct 2025 09:47:47 +0000 (17:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:02:42 +0000 (14:02 +0100)
commit8f4e27e870960cdc102e3e9ad89517f3c42ab8ae
tree9624160714bbc35d619485d3e6d2c9a0be0e9618
parent34de3867bdfdf5bee1e9b27efa91a0aab2e5d11e
mtd: rawnand: lpc32xx_slc: fix GPIO descriptor leak on probe error and remove

[ Upstream commit cdf44f1add4ec9ee80569d5a43e6e9bba0d74c7a ]

The driver calls gpiod_get_optional() in the probe function but
never calls gpiod_put() in the remove function or in the probe
error path. This leads to a GPIO descriptor resource leak.
The lpc32xx_mlc.c driver in the same directory handles this
correctly by calling gpiod_put() on both paths.

Add gpiod_put() in the remove function and in the probe error path
to fix the resource leak.

Fixes: 6b923db2867c ("mtd: rawnand: lpc32xx_slc: switch to using gpiod API")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/nand/raw/lpc32xx_slc.c