diff options
author | Olivier Moysan <olivier.moysan@st.com> | 2019-02-28 08:19:25 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-03-03 18:40:13 -0500 |
commit | d4180b4c02e7b04b8479f6237b2bd98b4c5fd19c (patch) | |
tree | 0a34bd6312db8145f77ec23557dd09faece26c51 /sound/soc/stm | |
parent | 71d9537fada47762a1a1b33a8a1f95a92d7edc11 (diff) |
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>
Diffstat (limited to 'sound/soc/stm')
-rw-r--r-- | sound/soc/stm/stm32_sai.c | 8 | ||||
-rw-r--r-- | sound/soc/stm/stm32_sai_sub.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sound/soc/stm/stm32_sai.c b/sound/soc/stm/stm32_sai.c index 14c9591aae42..d68d62f12df5 100644 --- a/sound/soc/stm/stm32_sai.c +++ b/sound/soc/stm/stm32_sai.c | |||
@@ -105,6 +105,7 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client, | |||
105 | if (!pdev) { | 105 | if (!pdev) { |
106 | dev_err(&sai_client->pdev->dev, | 106 | dev_err(&sai_client->pdev->dev, |
107 | "Device not found for node %pOFn\n", np_provider); | 107 | "Device not found for node %pOFn\n", np_provider); |
108 | of_node_put(np_provider); | ||
108 | return -ENODEV; | 109 | return -ENODEV; |
109 | } | 110 | } |
110 | 111 | ||
@@ -113,19 +114,20 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client, | |||
113 | dev_err(&sai_client->pdev->dev, | 114 | dev_err(&sai_client->pdev->dev, |
114 | "SAI sync provider data not found\n"); | 115 | "SAI sync provider data not found\n"); |
115 | ret = -EINVAL; | 116 | ret = -EINVAL; |
116 | goto out_put_dev; | 117 | goto error; |
117 | } | 118 | } |
118 | 119 | ||
119 | /* Configure sync client */ | 120 | /* Configure sync client */ |
120 | ret = stm32_sai_sync_conf_client(sai_client, synci); | 121 | ret = stm32_sai_sync_conf_client(sai_client, synci); |
121 | if (ret < 0) | 122 | if (ret < 0) |
122 | goto out_put_dev; | 123 | goto error; |
123 | 124 | ||
124 | /* Configure sync provider */ | 125 | /* Configure sync provider */ |
125 | ret = stm32_sai_sync_conf_provider(sai_provider, synco); | 126 | ret = stm32_sai_sync_conf_provider(sai_provider, synco); |
126 | 127 | ||
127 | out_put_dev: | 128 | error: |
128 | put_device(&pdev->dev); | 129 | put_device(&pdev->dev); |
130 | of_node_put(np_provider); | ||
129 | return ret; | 131 | return ret; |
130 | } | 132 | } |
131 | 133 | ||
diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index cb658463ccd1..55d802f51c15 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c | |||
@@ -1106,7 +1106,7 @@ static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd, | |||
1106 | static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) | 1106 | static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) |
1107 | { | 1107 | { |
1108 | struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev); | 1108 | struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev); |
1109 | int cr1 = 0, cr1_mask; | 1109 | int cr1 = 0, cr1_mask, ret; |
1110 | 1110 | ||
1111 | sai->cpu_dai = cpu_dai; | 1111 | sai->cpu_dai = cpu_dai; |
1112 | 1112 | ||
@@ -1136,8 +1136,10 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) | |||
1136 | /* Configure synchronization */ | 1136 | /* Configure synchronization */ |
1137 | if (sai->sync == SAI_SYNC_EXTERNAL) { | 1137 | if (sai->sync == SAI_SYNC_EXTERNAL) { |
1138 | /* Configure synchro client and provider */ | 1138 | /* Configure synchro client and provider */ |
1139 | sai->pdata->set_sync(sai->pdata, sai->np_sync_provider, | 1139 | ret = sai->pdata->set_sync(sai->pdata, sai->np_sync_provider, |
1140 | sai->synco, sai->synci); | 1140 | sai->synco, sai->synci); |
1141 | if (ret) | ||
1142 | return ret; | ||
1141 | } | 1143 | } |
1142 | 1144 | ||
1143 | cr1_mask |= SAI_XCR1_SYNCEN_MASK; | 1145 | cr1_mask |= SAI_XCR1_SYNCEN_MASK; |