Skip to content

Commit

Permalink
ASoC: loongson: Remove useless variable definitions
Browse files Browse the repository at this point in the history
In the function loongson_pcm_trigger and loongson_pcm_open,
the 'ret' is useless, so remove it to simplify code.

Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>
Link: https://patch.msgid.link/20240713153428.44858-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
tangbin authored and Mark Brown committed Aug 14, 2024
1 parent c8c3d9f commit 60b5c17
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions sound/soc/loongson/loongson_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ static int loongson_pcm_trigger(struct snd_soc_component *component,
struct device *dev = substream->pcm->card->dev;
void __iomem *order_reg = prtd->dma_data->order_addr;
u64 val;
int ret = 0;

switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
Expand Down Expand Up @@ -129,7 +128,7 @@ static int loongson_pcm_trigger(struct snd_soc_component *component,
return -EINVAL;
}

return ret;
return 0;
}

static int loongson_pcm_hw_params(struct snd_soc_component *component,
Expand Down Expand Up @@ -230,7 +229,6 @@ static int loongson_pcm_open(struct snd_soc_component *component,
struct snd_card *card = substream->pcm->card;
struct loongson_runtime_data *prtd;
struct loongson_dma_data *dma_data;
int ret;

/*
* For mysterious reasons (and despite what the manual says)
Expand All @@ -252,20 +250,17 @@ static int loongson_pcm_open(struct snd_soc_component *component,
prtd->dma_desc_arr = dma_alloc_coherent(card->dev, PAGE_SIZE,
&prtd->dma_desc_arr_phy,
GFP_KERNEL);
if (!prtd->dma_desc_arr) {
ret = -ENOMEM;
if (!prtd->dma_desc_arr)
goto desc_err;
}

prtd->dma_desc_arr_size = PAGE_SIZE / sizeof(*prtd->dma_desc_arr);

prtd->dma_pos_desc = dma_alloc_coherent(card->dev,
sizeof(*prtd->dma_pos_desc),
&prtd->dma_pos_desc_phy,
GFP_KERNEL);
if (!prtd->dma_pos_desc) {
ret = -ENOMEM;
if (!prtd->dma_pos_desc)
goto pos_err;
}

dma_data = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream);
prtd->dma_data = dma_data;
Expand All @@ -279,7 +274,7 @@ static int loongson_pcm_open(struct snd_soc_component *component,
desc_err:
kfree(prtd);

return ret;
return -ENOMEM;
}

static int loongson_pcm_close(struct snd_soc_component *component,
Expand Down

0 comments on commit 60b5c17

Please sign in to comment.