]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ALSA: usb: Drop superfluous PCM preallocation error checks
authorTakashi Iwai <tiwai@suse.de>
Mon, 4 Feb 2019 15:36:10 +0000 (16:36 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 6 Feb 2019 09:29:42 +0000 (10:29 +0100)
snd_pcm_lib_preallocate_pages() and co always succeed, so the error
check is simply redundant.  Drop it.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/usx2y/usbusx2yaudio.c
sound/usb/usx2y/usx2yhwdeppcm.c

index 2b833054e3b0d04236472e0df44ce2eef1a3fe97..58974d094b2720990c6937d2e45d04f8366dbbbd 100644 (file)
@@ -981,18 +981,17 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
 
        sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs);
 
-       if ((playback_endpoint &&
-            0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
-                                                    SNDRV_DMA_TYPE_CONTINUOUS,
-                                                    snd_dma_continuous_data(GFP_KERNEL),
-                                                    64*1024, 128*1024))) ||
-           0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
-                                                    SNDRV_DMA_TYPE_CONTINUOUS,
-                                                    snd_dma_continuous_data(GFP_KERNEL),
-                                                    64*1024, 128*1024))) {
-               snd_usX2Y_pcm_private_free(pcm);
-               return err;
+       if (playback_endpoint) {
+               snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
+                                             SNDRV_DMA_TYPE_CONTINUOUS,
+                                             snd_dma_continuous_data(GFP_KERNEL),
+                                             64*1024, 128*1024);
        }
+
+       snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
+                                     SNDRV_DMA_TYPE_CONTINUOUS,
+                                     snd_dma_continuous_data(GFP_KERNEL),
+                                     64*1024, 128*1024);
        usX2Y(card)->pcm_devs++;
 
        return 0;
index 4fd9276b8e501a198443ac0db59439365fd10c89..714cf50d4a4c6baefd6b17b63237fc891413dd98 100644 (file)
@@ -736,17 +736,14 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card)
        pcm->info_flags = 0;
 
        sprintf(pcm->name, NAME_ALLCAPS" hwdep Audio");
-       if (0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
-                                                    SNDRV_DMA_TYPE_CONTINUOUS,
-                                                    snd_dma_continuous_data(GFP_KERNEL),
-                                                    64*1024, 128*1024)) ||
-           0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
-                                                    SNDRV_DMA_TYPE_CONTINUOUS,
-                                                    snd_dma_continuous_data(GFP_KERNEL),
-                                                    64*1024, 128*1024))) {
-               return err;
-       }
-
+       snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
+                                     SNDRV_DMA_TYPE_CONTINUOUS,
+                                     snd_dma_continuous_data(GFP_KERNEL),
+                                     64*1024, 128*1024);
+       snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,
+                                     SNDRV_DMA_TYPE_CONTINUOUS,
+                                     snd_dma_continuous_data(GFP_KERNEL),
+                                     64*1024, 128*1024);
 
        return 0;
 }