spi: altera: Fix memory leak on error path

Release master that have been previously allocated if the number of
chipselect is invalid.

Fixes: 8e04187c1b ("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>
This commit is contained in:
Pan Bian 2021-01-20 00:26:35 -08:00 committed by Mark Brown
parent 4d163ad79b
commit 55a8b42e86
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 2 additions and 1 deletions

View File

@ -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;