diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-02-04 08:34:00 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-02-05 05:05:26 -0500 |
commit | 6ce1d63ed7210e7120070297976460f868c36314 (patch) | |
tree | d5759f217a1e21bfe555e8f609dd54bacc1ab1b4 | |
parent | 8f74ae398aa0b96207de366e9a723517e440e590 (diff) |
ALSA: core: Don't allow NULL device for memory allocation
Since we covered all callers with NULL device pointer, let's catch the
remaining calls with NULL and warn explicitly.
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/core/memalloc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 59a4adc286ed..eb974235c92b 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -182,6 +182,8 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, | |||
182 | return -ENXIO; | 182 | return -ENXIO; |
183 | if (WARN_ON(!dmab)) | 183 | if (WARN_ON(!dmab)) |
184 | return -ENXIO; | 184 | return -ENXIO; |
185 | if (WARN_ON(!device)) | ||
186 | return -EINVAL; | ||
185 | 187 | ||
186 | dmab->dev.type = type; | 188 | dmab->dev.type = type; |
187 | dmab->dev.dev = device; | 189 | dmab->dev.dev = device; |