summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2025-12-16 15:06:32 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-02-26 15:00:56 -0800
commitfb380a4a4d2ef0661199fc8f9d0451c74949f4e3 (patch)
tree841f8647bc6182a5dadeffebb778f57639badd70 /sound/usb
parent619b0029c8f491249d19d92810cacac4ad657000 (diff)
ALSA: usx2y: Relax __free() variable declarations
[ Upstream commit 43cc944c8e28d26f152198278f81cf7f9955ff85 ] We used to have a variable declaration with __free() initialized with NULL. This was to keep the old coding style rule, but recently it's relaxed and rather recommends to follow the new rule to declare in place of use for __free() -- which avoids potential deadlocks or UAFs with nested cleanups. Although the current code has no bug, per se, let's follow the new standard and move the declaration to the place of assignment (or directly assign the allocated result) instead of NULL initializations. Fixes: 67afec157fe6 ("ALSA: usb-audio: us144mkii: Add MIDI support and mixer controlsj") Fixes: a2a2210f2c2e ("ALSA: usb-audio: us144mkii: Implement audio playback and feedback") Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20251216140634.171890-11-tiwai@suse.de Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/usx2y/us144mkii.c4
-rw-r--r--sound/usb/usx2y/us144mkii_controls.c4
-rw-r--r--sound/usb/usx2y/us144mkii_pcm.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/sound/usb/usx2y/us144mkii.c b/sound/usb/usx2y/us144mkii.c
index f6572a576c15..bc71968df8e2 100644
--- a/sound/usb/usx2y/us144mkii.c
+++ b/sound/usb/usx2y/us144mkii.c
@@ -412,7 +412,6 @@ static int tascam_probe(struct usb_interface *intf,
struct snd_card *card;
struct tascam_card *tascam;
int err;
- char *handshake_buf __free(kfree) = NULL;
if (dev->speed != USB_SPEED_HIGH)
dev_info(
@@ -439,7 +438,8 @@ static int tascam_probe(struct usb_interface *intf,
return -ENOENT;
}
- handshake_buf = kmalloc(1, GFP_KERNEL);
+ char *handshake_buf __free(kfree) =
+ kmalloc(1, GFP_KERNEL);
if (!handshake_buf)
return -ENOMEM;
diff --git a/sound/usb/usx2y/us144mkii_controls.c b/sound/usb/usx2y/us144mkii_controls.c
index 5d69441ef414..62055fb8e7ba 100644
--- a/sound/usb/usx2y/us144mkii_controls.c
+++ b/sound/usb/usx2y/us144mkii_controls.c
@@ -373,7 +373,6 @@ static int tascam_samplerate_get(struct snd_kcontrol *kcontrol,
{
struct tascam_card *tascam =
(struct tascam_card *)snd_kcontrol_chip(kcontrol);
- u8 *buf __free(kfree) = NULL;
int err;
u32 rate = 0;
@@ -384,7 +383,8 @@ static int tascam_samplerate_get(struct snd_kcontrol *kcontrol,
}
}
- buf = kmalloc(3, GFP_KERNEL);
+ u8 *buf __free(kfree) =
+ kmalloc(3, GFP_KERNEL);
if (!buf)
return -ENOMEM;
diff --git a/sound/usb/usx2y/us144mkii_pcm.c b/sound/usb/usx2y/us144mkii_pcm.c
index 0c84304d4624..03dfb1f38801 100644
--- a/sound/usb/usx2y/us144mkii_pcm.c
+++ b/sound/usb/usx2y/us144mkii_pcm.c
@@ -115,7 +115,6 @@ void process_capture_routing_us144mkii(struct tascam_card *tascam,
int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
{
struct usb_device *dev = tascam->dev;
- u8 *rate_payload_buf __free(kfree) = NULL;
u16 rate_vendor_wValue;
int err = 0;
const u8 *current_payload_src;
@@ -148,7 +147,8 @@ int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
return -EINVAL;
}
- rate_payload_buf = kmemdup(current_payload_src, 3, GFP_KERNEL);
+ u8 *rate_payload_buf __free(kfree) =
+ kmemdup(current_payload_src, 3, GFP_KERNEL);
if (!rate_payload_buf)
return -ENOMEM;