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

Unverified Commit 960f428c authored by Jerome Brunet's avatar Jerome Brunet Committed by Mark Brown
Browse files

ASoC: meson: axg-card: fix null pointer dereference in clean up



When using modern dai_link style, we must first make sure the
struct snd_soc_dai_link_component exists before accessing its members.

In case of early probe deferral, some of the '.cpus' or '.codecs' may not
have been allocated yet. Check this before calling of_node_put() on the
structure member.

Fixes: c84836d7 ("ASoC: meson: axg-card: use modern dai_link style")
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6c0215f5
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -115,8 +115,10 @@ static void axg_card_clean_references(struct axg_card *priv)


	if (card->dai_link) {
	if (card->dai_link) {
		for_each_card_prelinks(card, i, link) {
		for_each_card_prelinks(card, i, link) {
			if (link->cpus)
				of_node_put(link->cpus->of_node);
				of_node_put(link->cpus->of_node);
			for_each_link_codecs(link, j, codec)
			for_each_link_codecs(link, j, codec)
				if (codec)
					of_node_put(codec->of_node);
					of_node_put(codec->of_node);
		}
		}
	}
	}