]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SDCA: Shrink detected_mode_handler() stack frame
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 22 Jul 2025 10:23:05 +0000 (11:23 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 22 Jul 2025 11:20:42 +0000 (12:20 +0100)
The stack frame for detected_mode_handler() is a bit large. Dynamically
allocate the control value struct, which is most of the size, to avoid
this.

Fixes: b9ab3b618241 ("ASoC: SDCA: Add some initial IRQ handlers")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202507182222.OLgOy9fX-lkp@intel.com/
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20250722102305.2513755-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sdca/sdca_interrupts.c

index d442ba2f56816a97445868923c57c5da9d4d7d8a..8018773ee4265e1e6a7c5be31c492622fca8e496 100644 (file)
@@ -144,7 +144,7 @@ static irqreturn_t detected_mode_handler(int irq, void *data)
        struct snd_soc_card *card = component->card;
        struct rw_semaphore *rwsem = &card->snd_card->controls_rwsem;
        struct snd_kcontrol *kctl = interrupt->priv;
-       struct snd_ctl_elem_value ucontrol;
+       struct snd_ctl_elem_value *ucontrol __free(kfree) = NULL;
        struct soc_enum *soc_enum;
        unsigned int reg, val;
        int ret;
@@ -204,10 +204,14 @@ static irqreturn_t detected_mode_handler(int irq, void *data)
 
        dev_dbg(dev, "%s: %#x\n", interrupt->name, val);
 
-       ucontrol.value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val);
+       ucontrol = kzalloc(sizeof(*ucontrol), GFP_KERNEL);
+       if (!ucontrol)
+               return IRQ_NONE;
+
+       ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val);
 
        down_write(rwsem);
-       ret = kctl->put(kctl, &ucontrol);
+       ret = kctl->put(kctl, ucontrol);
        up_write(rwsem);
        if (ret < 0) {
                dev_err(dev, "failed to update selected mode: %d\n", ret);