ASoC: stm32: sai: fix set_sync service
Add error check on set_sync function return. Add of_node_put() as of_get_parent() takes a reference which has to be released. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:

committed by
Mark Brown

parent
71d9537fad
commit
d4180b4c02
@@ -105,6 +105,7 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client,
|
|||||||
if (!pdev) {
|
if (!pdev) {
|
||||||
dev_err(&sai_client->pdev->dev,
|
dev_err(&sai_client->pdev->dev,
|
||||||
"Device not found for node %pOFn\n", np_provider);
|
"Device not found for node %pOFn\n", np_provider);
|
||||||
|
of_node_put(np_provider);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,19 +114,20 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client,
|
|||||||
dev_err(&sai_client->pdev->dev,
|
dev_err(&sai_client->pdev->dev,
|
||||||
"SAI sync provider data not found\n");
|
"SAI sync provider data not found\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out_put_dev;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure sync client */
|
/* Configure sync client */
|
||||||
ret = stm32_sai_sync_conf_client(sai_client, synci);
|
ret = stm32_sai_sync_conf_client(sai_client, synci);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out_put_dev;
|
goto error;
|
||||||
|
|
||||||
/* Configure sync provider */
|
/* Configure sync provider */
|
||||||
ret = stm32_sai_sync_conf_provider(sai_provider, synco);
|
ret = stm32_sai_sync_conf_provider(sai_provider, synco);
|
||||||
|
|
||||||
out_put_dev:
|
error:
|
||||||
put_device(&pdev->dev);
|
put_device(&pdev->dev);
|
||||||
|
of_node_put(np_provider);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1106,7 +1106,7 @@ static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd,
|
|||||||
static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai)
|
static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai)
|
||||||
{
|
{
|
||||||
struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev);
|
struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev);
|
||||||
int cr1 = 0, cr1_mask;
|
int cr1 = 0, cr1_mask, ret;
|
||||||
|
|
||||||
sai->cpu_dai = cpu_dai;
|
sai->cpu_dai = cpu_dai;
|
||||||
|
|
||||||
@@ -1136,8 +1136,10 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai)
|
|||||||
/* Configure synchronization */
|
/* Configure synchronization */
|
||||||
if (sai->sync == SAI_SYNC_EXTERNAL) {
|
if (sai->sync == SAI_SYNC_EXTERNAL) {
|
||||||
/* Configure synchro client and provider */
|
/* Configure synchro client and provider */
|
||||||
sai->pdata->set_sync(sai->pdata, sai->np_sync_provider,
|
ret = sai->pdata->set_sync(sai->pdata, sai->np_sync_provider,
|
||||||
sai->synco, sai->synci);
|
sai->synco, sai->synci);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
cr1_mask |= SAI_XCR1_SYNCEN_MASK;
|
cr1_mask |= SAI_XCR1_SYNCEN_MASK;
|
||||||
|
Reference in New Issue
Block a user