Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: da7219: Improve error checking of mclk enable/disable

Should only try to enable/disable the provided mclk, during bias
level changes, if it's not NULL. Also return value of
clk_prepare_enable() should be checked and dealt with accordingly.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Adam Thomson and committed by
Mark Brown
ba856fbd b7ebd78d

+11 -2
+11 -2
sound/soc/codecs/da7219.c
··· 1494 1494 enum snd_soc_bias_level level) 1495 1495 { 1496 1496 struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec); 1497 + int ret; 1497 1498 1498 1499 switch (level) { 1499 1500 case SND_SOC_BIAS_ON: ··· 1503 1502 case SND_SOC_BIAS_STANDBY: 1504 1503 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { 1505 1504 /* MCLK */ 1506 - clk_prepare_enable(da7219->mclk); 1505 + if (da7219->mclk) { 1506 + ret = clk_prepare_enable(da7219->mclk); 1507 + if (ret) { 1508 + dev_err(codec->dev, 1509 + "Failed to enable mclk\n"); 1510 + return ret; 1511 + } 1512 + } 1507 1513 1508 1514 /* Master bias */ 1509 1515 snd_soc_update_bits(codec, DA7219_REFERENCES, ··· 1536 1528 } 1537 1529 1538 1530 /* MCLK */ 1539 - clk_disable_unprepare(da7219->mclk); 1531 + if (da7219->mclk) 1532 + clk_disable_unprepare(da7219->mclk); 1540 1533 break; 1541 1534 } 1542 1535