Changeset f9597866 in mainline for uspace/drv/audio/hdaudio/hdactl.c


Ignore:
Timestamp:
2018-05-13T11:00:18Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
13db2044
Parents:
df96271
Message:

Avoid releasing DMA memory twice

When hda_corb_init or hda_rirb_init fail, they attempt to deallocate the
allocated DMA memory, but don't set the corb_virt or rirb_virt pointers
to NULL so that hda_ctl_init later calls hda_corb_fini and
hda_rirb_fini, where these pointers are found non-NULL and so the DMA
memory is deallocated for the second time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/hdaudio/hdactl.c

    rdf96271 rf9597866  
    223223        return EOK;
    224224error:
    225         if (hda->ctl->corb_virt != NULL)
     225        if (hda->ctl->corb_virt != NULL) {
    226226                dmamem_unmap_anonymous(&hda->ctl->corb_virt);
     227                hda->ctl->corb_virt = NULL;
     228        }
    227229        return EIO;
    228230}
     
    316318        return EOK;
    317319error:
    318         if (hda->ctl->rirb_virt != NULL)
     320        if (hda->ctl->rirb_virt != NULL) {
    319321                dmamem_unmap_anonymous(&hda->ctl->rirb_virt);
     322                hda->ctl->rirb_virt = NULL;
     323        }
    320324        return EIO;
    321325}
Note: See TracChangeset for help on using the changeset viewer.