Skip to content

Commit

Permalink
spi: altera: Fix memory leak on error path
Browse files Browse the repository at this point in the history
Release master that have been previously allocated if the number of
chipselect is invalid.

Fixes: 8e04187 ("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>
  • Loading branch information
Pan Bian authored and Mark Brown committed Jan 20, 2021
1 parent 4d163ad commit 55a8b42
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/spi/spi-altera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 55a8b42

Please sign in to comment.