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

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

ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init error path



Fix the error path to properly free allocated resources.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent b193deea
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@ static int __init at91sam9g20ek_init(void)
	if (!at91sam9g20ek_snd_device) {
		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
		ret = -ENOMEM;
		goto err_mclk;
	}

	platform_set_drvdata(at91sam9g20ek_snd_device,
@@ -248,11 +249,13 @@ static int __init at91sam9g20ek_init(void)
	ret = platform_device_add(at91sam9g20ek_snd_device);
	if (ret) {
		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
		platform_device_put(at91sam9g20ek_snd_device);
		goto err_device_add;
	}

	return ret;

err_device_add:
	platform_device_put(at91sam9g20ek_snd_device);
err_mclk:
	clk_put(mclk);
	mclk = NULL;