ASoC: samsung: i2s: Fix error handling path in i2s_set_sysclk()
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>
Sun, 3 Sep 2017 12:29:02 +0000 (14:29 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 4 Sep 2017 12:40:30 +0000 (13:40 +0100)
If 'clk_prepare_enable()' fails, we must 'put' the corresponding clock.
Othewise, there is a resource leak.

Fixes: f5c97c7b0438 ("ASoC: samsung: i2s: Handle return value of clk_prepare_enable.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/samsung/i2s.c

index 10a4da0..d7e7f42 100644 (file)
@@ -552,8 +552,11 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
                        }
 
                        ret = clk_prepare_enable(i2s->op_clk);
-                       if (ret)
+                       if (ret) {
+                               clk_put(i2s->op_clk);
+                               i2s->op_clk = NULL;
                                goto err;
+                       }
                        i2s->rclk_srcrate = clk_get_rate(i2s->op_clk);
 
                        /* Over-ride the other's */