Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: tegra_sgtl5000: fix device_node refcounting

Similar to the following:

commit 4321723648b0 ("ASoC: tegra_alc5632: fix device_node refcounting")

commit 7c5dfd549617 ("ASoC: tegra: fix device_node refcounting")

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Marcel Ziswiler and committed by
Mark Brown
a85227da 7e95aac9

+15 -2
+15 -2
sound/soc/tegra/tegra_sgtl5000.c
··· 149 149 dev_err(&pdev->dev, 150 150 "Property 'nvidia,i2s-controller' missing/invalid\n"); 151 151 ret = -EINVAL; 152 - goto err; 152 + goto err_put_codec_of_node; 153 153 } 154 154 155 155 tegra_sgtl5000_dai.platform_of_node = tegra_sgtl5000_dai.cpu_of_node; 156 156 157 157 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); 158 158 if (ret) 159 - goto err; 159 + goto err_put_cpu_of_node; 160 160 161 161 ret = snd_soc_register_card(card); 162 162 if (ret) { ··· 169 169 170 170 err_fini_utils: 171 171 tegra_asoc_utils_fini(&machine->util_data); 172 + err_put_cpu_of_node: 173 + of_node_put(tegra_sgtl5000_dai.cpu_of_node); 174 + tegra_sgtl5000_dai.cpu_of_node = NULL; 175 + tegra_sgtl5000_dai.platform_of_node = NULL; 176 + err_put_codec_of_node: 177 + of_node_put(tegra_sgtl5000_dai.codec_of_node); 178 + tegra_sgtl5000_dai.codec_of_node = NULL; 172 179 err: 173 180 return ret; 174 181 } ··· 189 182 ret = snd_soc_unregister_card(card); 190 183 191 184 tegra_asoc_utils_fini(&machine->util_data); 185 + 186 + of_node_put(tegra_sgtl5000_dai.cpu_of_node); 187 + tegra_sgtl5000_dai.cpu_of_node = NULL; 188 + tegra_sgtl5000_dai.platform_of_node = NULL; 189 + of_node_put(tegra_sgtl5000_dai.codec_of_node); 190 + tegra_sgtl5000_dai.codec_of_node = NULL; 192 191 193 192 return ret; 194 193 }