]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: soc-dai: check return value at snd_soc_dai_set_tdm_slot()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 12 Feb 2025 02:24:38 +0000 (02:24 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:40:14 +0000 (14:40 +0200)
[ Upstream commit 7f1186a8d738661b941b298fd6d1d5725ed71428 ]

snd_soc_dai_set_tdm_slot() calls .xlate_tdm_slot_mask() or
snd_soc_xlate_tdm_slot_mask(), but didn't check its return value.
Let's check it.

This patch might break existing driver. In such case, let's makes
each func to void instead of int.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87o6z7yk61.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/soc-dai.c

index 49752af0e205d69600e2fe9ae895cec104141d5c..ba38b6e6b2649499860c055b623fba2194bf936a 100644 (file)
@@ -270,10 +270,11 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
 
        if (dai->driver->ops &&
            dai->driver->ops->xlate_tdm_slot_mask)
-               dai->driver->ops->xlate_tdm_slot_mask(slots,
-                                                     &tx_mask, &rx_mask);
+               ret = dai->driver->ops->xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);
        else
-               snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);
+               ret = snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);
+       if (ret)
+               goto err;
 
        dai->tx_mask = tx_mask;
        dai->rx_mask = rx_mask;
@@ -282,6 +283,7 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
            dai->driver->ops->set_tdm_slot)
                ret = dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask,
                                                      slots, slot_width);
+err:
        return soc_dai_ret(dai, ret);
 }
 EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot);