diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 59a4adc286ed77bb647788706a6ebd9323a1b640..eb974235c92bdfba19d706735a88a9cf95897664 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,
 		return -ENXIO;
 	if (WARN_ON(!dmab))
 		return -ENXIO;
+	if (WARN_ON(!device))
+		return -EINVAL;
 
 	dmab->dev.type = type;
 	dmab->dev.dev = device;