]> www.infradead.org Git - users/hch/misc.git/commitdiff
ALSA: hda/realtek: Use auto cleanup for temporary buffers
authorTakashi Iwai <tiwai@suse.de>
Wed, 27 Aug 2025 07:29:00 +0000 (09:29 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 29 Aug 2025 09:52:15 +0000 (11:52 +0200)
The release of temporary kmalloced buffers can be nicely handled via
the standard __free(kfree).

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250827072916.31933-21-tiwai@suse.de
sound/hda/codecs/realtek/realtek.c

index d40de0e8a9a398c529c6755c3fda7a92d31b22f6..ca377a5adadb5b44cc44fede43b96d5704a5436b 100644 (file)
@@ -215,7 +215,7 @@ void alc_update_knob_master(struct hda_codec *codec,
 {
        unsigned int val;
        struct snd_kcontrol *kctl;
-       struct snd_ctl_elem_value *uctl;
+       struct snd_ctl_elem_value *uctl __free(kfree) = NULL;
 
        kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
        if (!kctl)
@@ -229,7 +229,6 @@ void alc_update_knob_master(struct hda_codec *codec,
        uctl->value.integer.value[0] = val;
        uctl->value.integer.value[1] = val;
        kctl->put(kctl, uctl);
-       kfree(uctl);
 }
 EXPORT_SYMBOL_NS_GPL(alc_update_knob_master, "SND_HDA_CODEC_REALTEK");