Index: uspace/drv/audio/hdaudio/hdactl.c
===================================================================
--- uspace/drv/audio/hdaudio/hdactl.c	(revision 3fec81799ad43cfaf3a7caeb22ea5356d0b63b51)
+++ uspace/drv/audio/hdaudio/hdactl.c	(revision de16f892e37393d27d9d32f487cc511dc31bbd38)
@@ -217,5 +217,20 @@
 	return EOK;
 error:
+	if (hda->ctl->corb_virt != NULL)
+		dmamem_unmap_anonymous(&hda->ctl->corb_virt);
 	return EIO;
+}
+
+/** Tear down the CORB */
+static void hda_corb_fini(hda_t *hda)
+{
+	uint8_t ctl;
+
+	/* Stop CORB */
+	ctl = hda_reg8_read(&hda->regs->corbctl);
+	hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t, corbctl_run));
+
+	if (hda->ctl->corb_virt != NULL)
+		dmamem_unmap_anonymous(&hda->ctl->corb_virt);
 }
 
@@ -290,5 +305,21 @@
 	return EOK;
 error:
+	if (hda->ctl->rirb_virt != NULL)
+		dmamem_unmap_anonymous(&hda->ctl->rirb_virt);
 	return EIO;
+}
+
+/** Tear down the RIRB */
+static void hda_rirb_fini(hda_t *hda)
+{
+	uint8_t ctl;
+
+	/* Stop RIRB and disable RIRB interrupt */
+	ctl = hda_reg8_read(&hda->regs->rirbctl);
+	hda_reg8_write(&hda->regs->rirbctl, ctl &
+	    ~(BIT_V(uint8_t, rirbctl_run) | BIT_V(uint8_t, rirbctl_int)));
+
+	if (hda->ctl->rirb_virt != NULL)
+		dmamem_unmap_anonymous(&hda->ctl->rirb_virt);
 }
 
@@ -571,7 +602,17 @@
 	return ctl;
 error:
+	hda_rirb_fini(hda);
+	hda_corb_fini(hda);
 	free(ctl);
 	hda->ctl = NULL;
 	return NULL;
+}
+
+void hda_ctl_fini(hda_ctl_t *ctl)
+{
+	ddf_msg(LVL_NOTE, "hda_ctl_fini()");
+	hda_rirb_fini(ctl->hda);
+	hda_corb_fini(ctl->hda);
+	free(ctl);
 }
 
@@ -595,10 +636,4 @@
 
 	return EOK;
-}
-
-void hda_ctl_fini(hda_ctl_t *ctl)
-{
-	ddf_msg(LVL_NOTE, "hda_ctl_fini()");
-	free(ctl);
 }
 
Index: uspace/drv/audio/hdaudio/hdaudio.c
===================================================================
--- uspace/drv/audio/hdaudio/hdaudio.c	(revision 3fec81799ad43cfaf3a7caeb22ea5356d0b63b51)
+++ uspace/drv/audio/hdaudio/hdaudio.c	(revision de16f892e37393d27d9d32f487cc511dc31bbd38)
@@ -150,17 +150,18 @@
 static int hda_dev_add(ddf_dev_t *dev)
 {
-	ddf_fun_t *fun_pcm;
+	ddf_fun_t *fun_pcm = NULL;
 	hda_t *hda = NULL;
 	hw_res_list_parsed_t res;
 	irq_code_t irq_code;
-	irq_cmd_t *cmds;
+	irq_cmd_t *cmds = NULL;
 	size_t ncmds_base;
 	size_t ncmds_sdesc;
 	size_t ncmds;
 	int i;
-	void *regs;
+	void *regs = NULL;
 	int rc;
 
 	ddf_msg(LVL_NOTE, "hda_dev_add()");
+	hw_res_list_parsed_init(&res);
 
 	hda = ddf_dev_data_alloc(dev, sizeof(hda_t));
@@ -181,5 +182,4 @@
 
 	ddf_msg(LVL_NOTE, "get HW res list");
-	hw_res_list_parsed_init(&res);
 	rc = hw_res_get_list_parsed(hda->parent_sess, &res, 0);
 	if (rc != EOK) {
@@ -270,4 +270,7 @@
 	}
 
+	free(cmds);
+	cmds = NULL;
+
 	if (hda_ctl_init(hda) == NULL) {
 		rc = EIO;
@@ -295,10 +298,17 @@
 
 	ddf_fun_add_to_category(fun_pcm, "audio-pcm");
+
+	hw_res_list_parsed_clean(&res);
 	return EOK;
 error:
+	if (fun_pcm != NULL)
+		ddf_fun_destroy(fun_pcm);
 	if (hda != NULL) {
 		if (hda->ctl != NULL)
 			hda_ctl_fini(hda->ctl);
 	}
+	free(cmds);
+	// pio_disable(regs);
+	hw_res_list_parsed_clean(&res);
 
 	ddf_msg(LVL_NOTE, "Failing hda_dev_add() -> %d", rc);
@@ -323,4 +333,6 @@
 	}
 
+	hda_ctl_fini(hda->ctl);
+	// pio_disable(regs);
 	return EOK;
 }
