Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd3c8ac9 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

ASoC: ad1836: fix a memory leak if another ad1836 is registered



ad1836 is allocated in ad1836_spi_probe() but is not freed if ad1836_register()
return -EINVAL (if another ad1836 is registered).

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarBarry Song <21cnbao@gmail.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 992bee40
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -272,6 +272,7 @@ static int ad1836_register(struct ad1836_priv *ad1836)

	if (ad1836_codec) {
		dev_err(codec->dev, "Another ad1836 is registered\n");
		kfree(ad1836);
		return -EINVAL;
	}