diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index c1764c59243e9a84730992c4aa576e9768d8eb66..40862e661359c6c70143ded42cd77986beb90f00 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -55,15 +55,6 @@ static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
 	list_del(&dmabuf->list_node);
 	mutex_unlock(&debugfs_list_mutex);
 }
-#else
-static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
-{
-}
-
-static void __dma_buf_debugfs_list_del(struct file *file)
-{
-}
-#endif
 
 /*
  * This function helps in traversing the db_list and calls the
@@ -74,20 +65,29 @@ int get_each_dmabuf(int (*callback)(const struct dma_buf *dmabuf,
 		    void *private), void *private)
 {
 	struct dma_buf *buf;
-	int ret = mutex_lock_interruptible(&db_list.lock);
+	int ret = mutex_lock_interruptible(&debugfs_list_mutex);
 
 	if (ret)
 		return ret;
 
-	list_for_each_entry(buf, &db_list.head, list_node) {
+	list_for_each_entry(buf, &debugfs_list, list_node) {
 		ret = callback(buf, private);
 		if (ret)
 			break;
 	}
-	mutex_unlock(&db_list.lock);
+	mutex_unlock(&debugfs_list_mutex);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(get_each_dmabuf);
+#else
+static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
+{
+}
+
+static void __dma_buf_debugfs_list_del(struct file *file)
+{
+}
+#endif
 
 static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen)
 {