ALSA: pcm: Use automatic cleanup of kfree()
authorTakashi Iwai <tiwai@suse.de>
Thu, 22 Feb 2024 11:15:01 +0000 (12:15 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 23 Feb 2024 09:57:30 +0000 (10:57 +0100)
commitae921398486419c6284d70bd8332eb7edbdb4f70
tree58d3cfe9a8d328cf36aef57f375fe1c79306e77c
parentec89fc1b71766c9e7a122f8ba7a21933fe6a95b4
ALSA: pcm: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

A caveat is that some allocations are memdup_user() and they return an
error pointer instead of NULL.  Those need special cares and the value
has to be cleared with no_free_ptr() at the allocation error path.

Other than that, the conversions are straightforward.

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-2-tiwai@suse.de
sound/core/pcm.c
sound/core/pcm_compat.c
sound/core/pcm_native.c