Skip to content

Commit

Permalink
spi: altera: Fix memory leak on error path
Browse files Browse the repository at this point in the history
[ Upstream commit 55a8b42 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
SinkFinder authored and gregkh committed Feb 3, 2021
1 parent 2bfc7e6 commit cea3d7c
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 cea3d7c

Please sign in to comment.