Commit ca1697eb authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Takashi Iwai

ALSA: spi: Add check for clk_enable()

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: 3568459a ("ALSA: at73c213: manage SSC clock")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220228022839.3547266-1-jiasheng@iscas.ac.cnSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a544684b
......@@ -218,7 +218,9 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream)
runtime->hw = snd_at73c213_playback_hw;
chip->substream = substream;
clk_enable(chip->ssc->clk);
err = clk_enable(chip->ssc->clk);
if (err)
return err;
return 0;
}
......@@ -776,7 +778,9 @@ static int snd_at73c213_chip_init(struct snd_at73c213 *chip)
goto out;
/* Enable DAC master clock. */
clk_enable(chip->board->dac_clk);
retval = clk_enable(chip->board->dac_clk);
if (retval)
goto out;
/* Initialize at73c213 on SPI bus. */
retval = snd_at73c213_write_reg(chip, DAC_RST, 0x04);
......@@ -889,7 +893,9 @@ static int snd_at73c213_dev_init(struct snd_card *card,
chip->card = card;
chip->irq = -1;
clk_enable(chip->ssc->clk);
retval = clk_enable(chip->ssc->clk);
if (retval)
return retval;
retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip);
if (retval) {
......@@ -1008,7 +1014,9 @@ static int snd_at73c213_remove(struct spi_device *spi)
int retval;
/* Stop playback. */
clk_enable(chip->ssc->clk);
retval = clk_enable(chip->ssc->clk);
if (retval)
goto out;
ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS));
clk_disable(chip->ssc->clk);
......@@ -1088,9 +1096,16 @@ static int snd_at73c213_resume(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
struct snd_at73c213 *chip = card->private_data;
int retval;
clk_enable(chip->board->dac_clk);
clk_enable(chip->ssc->clk);
retval = clk_enable(chip->board->dac_clk);
if (retval)
return retval;
retval = clk_enable(chip->ssc->clk);
if (retval) {
clk_disable(chip->board->dac_clk);
return retval;
}
ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN));
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment