summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2021-01-20 09:26:35 +0100
committerMark Brown <broonie@kernel.org>2021-01-20 17:46:50 +0100
commit55a8b42e8645a6dab88674a30cb6ed328e660680 (patch)
treecfea7118a63f5a9c5cddbe3c671a0b9aa960987a
parentspi: cadence: cache reference clock rate during probe (diff)
downloadlinux-55a8b42e8645a6dab88674a30cb6ed328e660680.tar.xz
linux-55a8b42e8645a6dab88674a30cb6ed328e660680.zip
spi: altera: Fix memory leak on error path
Release master that have been previously allocated if the number of chipselect is invalid. Fixes: 8e04187c1bc7 ("spi: altera: add SPI core parameters support via platform data.") Signed-off-by: Pan Bian <bianpan2016@163.com> Reviewed-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/r/20210120082635.49304-1-bianpan2016@163.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-altera.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index cbc4c28c1541..62ea0c9e321b 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -254,7 +254,8 @@ static int altera_spi_probe(struct platform_device *pdev)
dev_err(&pdev->dev,
"Invalid number of chipselect: %hu\n",
pdata->num_chipselect);
- return -EINVAL;
+ err = -EINVAL;
+ goto exit;
}
master->num_chipselect = pdata->num_chipselect;