spi: lpspi: fix memory leak in fsl_lpspi_probe
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Mon, 30 Sep 2019 03:46:01 +0000 (22:46 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2020 18:49:01 +0000 (19:49 +0100)
commitbf3b4bc7bb03a2b0e67078d42a1d43ce05a14b7b
treeba64f511796d3de6681cc2b8cbecea6b48fbafeb
parent091f7685cbd115b101250be70717e6bce9aa7889
spi: lpspi: fix memory leak in fsl_lpspi_probe

commit 057b8945f78f76d0b04eeb5c27cd9225e5e7ad86 upstream.

In fsl_lpspi_probe an SPI controller is allocated either via
spi_alloc_slave or spi_alloc_master. In all but one error cases this
controller is put by going to error handling code. This commit fixes the
case when pm_runtime_get_sync fails and it should go to the error
handling path.

Fixes: 944c01a889d9 ("spi: lpspi: enable runtime pm for lpspi")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20190930034602.1467-1-navid.emamdoost@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi-fsl-lpspi.c