From: Pan Bian Date: Wed, 20 Jan 2021 08:26:35 +0000 (-0800) Subject: spi: altera: Fix memory leak on error path X-Git-Tag: v5.15~1908^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55a8b42e8645a6dab88674a30cb6ed328e660680;p=platform%2Fkernel%2Flinux-starfive.git 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 Reviewed-by: Tom Rix Link: https://lore.kernel.org/r/20210120082635.49304-1-bianpan2016@163.com Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index cbc4c28..62ea0c9 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;