diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-11 17:40:57 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-08-12 23:20:18 +0200 |
commit | 6fd9ff7b019f5629e0f1f3a10bd4c03adfd7ec4e (patch) | |
tree | 1a5717ebaa08c6f4825769bbebaf5d3e4c75eafc | |
parent | ALSA: trident: constify snd_pcm_ops structures (diff) | |
download | linux-6fd9ff7b019f5629e0f1f3a10bd4c03adfd7ec4e.tar.xz linux-6fd9ff7b019f5629e0f1f3a10bd4c03adfd7ec4e.zip |
ALSA: usx2y: Delete an error message for a failed memory allocation in two functions
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index dd40ca9d858a..612aa7ff7e18 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -419,10 +419,8 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) if (is_playback && NULL == subs->tmpbuf) { /* allocate a temporary buffer for playback */ subs->tmpbuf = kcalloc(nr_of_packs(), subs->maxpacksize, GFP_KERNEL); - if (NULL == subs->tmpbuf) { - snd_printk(KERN_ERR "cannot malloc tmpbuf\n"); + if (!subs->tmpbuf) return -ENOMEM; - } } /* allocate and initialize data urbs */ for (i = 0; i < NRURBS; i++) { @@ -949,10 +947,9 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { usX2Y_substream[i] = kzalloc(sizeof(struct snd_usX2Y_substream), GFP_KERNEL); - if (NULL == usX2Y_substream[i]) { - snd_printk(KERN_ERR "cannot malloc\n"); + if (!usX2Y_substream[i]) return -ENOMEM; - } + usX2Y_substream[i]->usX2Y = usX2Y(card); } |