diff options
author | Jarkko Nikula <jarkko.nikula@nokia.com> | 2008-08-26 06:32:57 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-08-26 06:44:03 -0400 |
commit | e784539fe81490a982a013621d39a60c4fce427e (patch) | |
tree | 1d809f790fe19a8faf46c9baa1da7dcf8b983a04 /sound | |
parent | 3d839e5b87a70effc629c1cdbf77d837ef141919 (diff) |
ALSA: ASoC: Fix error paths in N810 machine driver init and release clocks at exit
Thanks to Felipe Balbi <felipe.balbi@nokia.com> by noticing that if clk_get
to sys_clkout2_src fails, then n810_snd_device is never released.
Add also sys_clkout2_src release into error path, error code return and
release the clocks at exit.
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/omap/n810.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 7694621ec40b..87d0ed01f65a 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -329,12 +329,14 @@ static int __init n810_soc_init(void) | |||
329 | sys_clkout2_src = clk_get(dev, "sys_clkout2_src"); | 329 | sys_clkout2_src = clk_get(dev, "sys_clkout2_src"); |
330 | if (IS_ERR(sys_clkout2_src)) { | 330 | if (IS_ERR(sys_clkout2_src)) { |
331 | dev_err(dev, "Could not get sys_clkout2_src clock\n"); | 331 | dev_err(dev, "Could not get sys_clkout2_src clock\n"); |
332 | return -ENODEV; | 332 | err = PTR_ERR(sys_clkout2_src); |
333 | goto err2; | ||
333 | } | 334 | } |
334 | sys_clkout2 = clk_get(dev, "sys_clkout2"); | 335 | sys_clkout2 = clk_get(dev, "sys_clkout2"); |
335 | if (IS_ERR(sys_clkout2)) { | 336 | if (IS_ERR(sys_clkout2)) { |
336 | dev_err(dev, "Could not get sys_clkout2\n"); | 337 | dev_err(dev, "Could not get sys_clkout2\n"); |
337 | goto err1; | 338 | err = PTR_ERR(sys_clkout2); |
339 | goto err3; | ||
338 | } | 340 | } |
339 | /* | 341 | /* |
340 | * Configure 12 MHz output on SYS_CLKOUT2. Therefore we must use | 342 | * Configure 12 MHz output on SYS_CLKOUT2. Therefore we must use |
@@ -343,7 +345,8 @@ static int __init n810_soc_init(void) | |||
343 | func96m_clk = clk_get(dev, "func_96m_ck"); | 345 | func96m_clk = clk_get(dev, "func_96m_ck"); |
344 | if (IS_ERR(func96m_clk)) { | 346 | if (IS_ERR(func96m_clk)) { |
345 | dev_err(dev, "Could not get func 96M clock\n"); | 347 | dev_err(dev, "Could not get func 96M clock\n"); |
346 | goto err2; | 348 | err = PTR_ERR(func96m_clk); |
349 | goto err4; | ||
347 | } | 350 | } |
348 | clk_set_parent(sys_clkout2_src, func96m_clk); | 351 | clk_set_parent(sys_clkout2_src, func96m_clk); |
349 | clk_set_rate(sys_clkout2, 12000000); | 352 | clk_set_rate(sys_clkout2, 12000000); |
@@ -356,20 +359,25 @@ static int __init n810_soc_init(void) | |||
356 | gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0); | 359 | gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0); |
357 | 360 | ||
358 | return 0; | 361 | return 0; |
359 | err2: | 362 | err4: |
360 | clk_put(sys_clkout2); | 363 | clk_put(sys_clkout2); |
364 | err3: | ||
365 | clk_put(sys_clkout2_src); | ||
366 | err2: | ||
361 | platform_device_del(n810_snd_device); | 367 | platform_device_del(n810_snd_device); |
362 | err1: | 368 | err1: |
363 | platform_device_put(n810_snd_device); | 369 | platform_device_put(n810_snd_device); |
364 | 370 | ||
365 | return err; | 371 | return err; |
366 | |||
367 | } | 372 | } |
368 | 373 | ||
369 | static void __exit n810_soc_exit(void) | 374 | static void __exit n810_soc_exit(void) |
370 | { | 375 | { |
371 | gpio_free(N810_SPEAKER_AMP_GPIO); | 376 | gpio_free(N810_SPEAKER_AMP_GPIO); |
372 | gpio_free(N810_HEADSET_AMP_GPIO); | 377 | gpio_free(N810_HEADSET_AMP_GPIO); |
378 | clk_put(sys_clkout2_src); | ||
379 | clk_put(sys_clkout2); | ||
380 | clk_put(func96m_clk); | ||
373 | 381 | ||
374 | platform_device_unregister(n810_snd_device); | 382 | platform_device_unregister(n810_snd_device); |
375 | } | 383 | } |