Skip to contentSkip to conversation

spi: altera: Fix memory leak on error path

PATCH In review Pan Bian 5 participants 5 messages Jan 20, 2021 – Jan 21, 2021 SPI

lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 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.")
---
 drivers/spi/spi-altera.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-altera.c +2 -1
index cbc4c28c1541..62ea0c9e321b 100644
@@ -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;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · Pan Bian

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.")
---
 drivers/spi/spi-altera.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-altera.c +0 -0
index cbc4c28c1541..62ea0c9e321b 100644

drivers/spi/spi-altera.c static int altera_spi_probe(struct platform_device *pdev) · line 258

Quoted 6 lines
drivers/spi/spi-altera.c +2 -1
@@ -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;

Thanks for the fix. Looks good to me.

Yilun

Reviewed-by on v1 1/1
#2 lore raw
In reply to Pan Bian
Quoted 14 lines · Pan Bian

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.")
---
 drivers/spi/spi-altera.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-altera.c +0 -0
index cbc4c28c1541..62ea0c9e321b 100644

drivers/spi/spi-altera.c static int altera_spi_probe(struct platform_device *pdev) · line 261

Quoted 9 lines
drivers/spi/spi-altera.c +2 -1
@@ -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;
maintainer
#3 lore raw
In reply to Pan Bian
Quoted 2 lines · Pan Bian

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

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: altera: Fix memory leak on error path

      commit: 55a8b42e8645a6dab88674a30cb6ed328e660680

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Acked-by on v1 1/1
#4 lore raw
In reply to Pan Bian
Quoted 5 lines · Pan Bian

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.")
Quoted 22 lines

---
drivers/spi/spi-altera.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-altera.c +2 -1
index cbc4c28c1541..62ea0c9e321b 100644
@@ -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;
Signature · 1 line
2.17.1