Skip to content

Commit 057b894

Browse files
Navidembroonie
authored andcommitted
spi: lpspi: fix memory leak in fsl_lpspi_probe
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: 944c01a ("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>
1 parent d3b0ffa commit 057b894

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: drivers/spi/spi-fsl-lpspi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
938938
ret = pm_runtime_get_sync(fsl_lpspi->dev);
939939
if (ret < 0) {
940940
dev_err(fsl_lpspi->dev, "failed to enable clock\n");
941-
return ret;
941+
goto out_controller_put;
942942
}
943943

944944
temp = readl(fsl_lpspi->base + IMX7ULP_PARAM);

0 commit comments

Comments
 (0)