HomeFreeBSD

sound: Safely remove channel from list in one pass

Description

sound: Safely remove channel from list in one pass

The CHN_REMOVE_SAFE() macro did two traversals of the channel list to
remove a channel, one to check whether the channel is an element of the
list, and a second traversal through SLIST_REMOVE(). Reduce this to one
traversal, while still preventing a NULL dereference in case the channel
in question is not present in the list.

While here, rename the macro arguments to something more descriptive.

MFC after: 1 week
Reviewed by: christos
Differential Revision: https://reviews.freebsd.org/D48207

Details

Provenance
dev_submerge.chAuthored on Tue, Jan 21, 11:59 AM
christosCommitted on Tue, Jan 21, 12:00 PM
Reviewer
christos
Differential Revision
D48207: sound: Safely remove channel from list in one pass
Parents
rG27ef5d48c729: sound: Unit test the pcm sample read and write macros
Branches
Unknown
Tags
Unknown