Commit 62961dd5 authored by Takashi Iwai's avatar Takashi Iwai

ASoC: intel: Drop superfluous PCM preallocation error checks

snd_pcm_lib_preallocate_pages() and co always succeed, so the error
check is simply redundant.  Drop it.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ad8ba770
...@@ -687,20 +687,15 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -687,20 +687,15 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int retval = 0;
if (dai->driver->playback.channels_min || if (dai->driver->playback.channels_min ||
dai->driver->capture.channels_min) { dai->driver->capture.channels_min) {
retval = snd_pcm_lib_preallocate_pages_for_all(pcm, snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS, SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_DMA), snd_dma_continuous_data(GFP_DMA),
SST_MIN_BUFFER, SST_MAX_BUFFER); SST_MIN_BUFFER, SST_MAX_BUFFER);
if (retval) {
dev_err(rtd->dev, "dma buffer allocation failure\n");
return retval;
}
} }
return retval; return 0;
} }
static int sst_soc_probe(struct snd_soc_component *component) static int sst_soc_probe(struct snd_soc_component *component)
......
...@@ -327,23 +327,16 @@ static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -327,23 +327,16 @@ static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd)
size_t size; size_t size;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
struct sst_pdata *pdata = dev_get_platdata(component->dev); struct sst_pdata *pdata = dev_get_platdata(component->dev);
int ret = 0;
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
size = sst_byt_pcm_hardware.buffer_bytes_max; size = sst_byt_pcm_hardware.buffer_bytes_max;
ret = snd_pcm_lib_preallocate_pages_for_all(pcm, snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
SNDRV_DMA_TYPE_DEV, pdata->dma_dev,
pdata->dma_dev, size, size);
size, size);
if (ret) {
dev_err(rtd->dev, "dma buffer allocation failed %d\n",
ret);
return ret;
}
} }
return ret; return 0;
} }
static struct snd_soc_dai_driver byt_dais[] = { static struct snd_soc_dai_driver byt_dais[] = {
......
...@@ -946,27 +946,21 @@ static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -946,27 +946,21 @@ static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd)
struct sst_pdata *pdata = dev_get_platdata(component->dev); struct sst_pdata *pdata = dev_get_platdata(component->dev);
struct hsw_priv_data *priv_data = dev_get_drvdata(component->dev); struct hsw_priv_data *priv_data = dev_get_drvdata(component->dev);
struct device *dev = pdata->dma_dev; struct device *dev = pdata->dma_dev;
int ret = 0;
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = snd_pcm_lib_preallocate_pages_for_all(pcm, snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_DEV_SG, SNDRV_DMA_TYPE_DEV_SG,
dev, dev,
hsw_pcm_hardware.buffer_bytes_max, hsw_pcm_hardware.buffer_bytes_max,
hsw_pcm_hardware.buffer_bytes_max); hsw_pcm_hardware.buffer_bytes_max);
if (ret) {
dev_err(rtd->dev, "dma buffer allocation failed %d\n",
ret);
return ret;
}
} }
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_PLAYBACK].hsw_pcm = pcm; priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_PLAYBACK].hsw_pcm = pcm;
if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_CAPTURE].hsw_pcm = pcm; priv_data->pcm[rtd->cpu_dai->id][SNDRV_PCM_STREAM_CAPTURE].hsw_pcm = pcm;
return ret; return 0;
} }
#define HSW_FORMATS \ #define HSW_FORMATS \
......
...@@ -1289,7 +1289,6 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -1289,7 +1289,6 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd)
struct hdac_bus *bus = dev_get_drvdata(dai->dev); struct hdac_bus *bus = dev_get_drvdata(dai->dev);
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
unsigned int size; unsigned int size;
int retval = 0;
struct skl *skl = bus_to_skl(bus); struct skl *skl = bus_to_skl(bus);
if (dai->driver->playback.channels_min || if (dai->driver->playback.channels_min ||
...@@ -1298,17 +1297,13 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -1298,17 +1297,13 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd)
size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024; size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024;
if (size > MAX_PREALLOC_SIZE) if (size > MAX_PREALLOC_SIZE)
size = MAX_PREALLOC_SIZE; size = MAX_PREALLOC_SIZE;
retval = snd_pcm_lib_preallocate_pages_for_all(pcm, snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_DEV_SG, SNDRV_DMA_TYPE_DEV_SG,
snd_dma_pci_data(skl->pci), snd_dma_pci_data(skl->pci),
size, MAX_PREALLOC_SIZE); size, MAX_PREALLOC_SIZE);
if (retval) {
dev_err(dai->dev, "dma buffer allocation fail\n");
return retval;
}
} }
return retval; return 0;
} }
static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig) static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig)
......
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