]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: tas2781: fix clang build error for goto bypassing cleanup variable
authorShenghao Ding <shenghao-ding@ti.com>
Fri, 7 Aug 2026 00:03:04 +0000 (08:03 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 10 Aug 2026 12:27:44 +0000 (13:27 +0100)
Remove invalid goto exit paths that jump across guard(mutex) cleanup
variable initialization, replace them with direct kfree(src) and return,
to fix the s390 clang build error in acoustic_ctl_write().

Fixes: d75d38dc4604 ("ASoC: tas2781: Add a debugfs node for acoustic tuning")
Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20260807000304.826-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tas2781-i2c.c

index 209067e98e1fdf1fcc8c3ca7d7e3aa408fd75d32..95d875c44b91296962b9f09ee333c421357a7e99 100644 (file)
@@ -1544,8 +1544,8 @@ static ssize_t acoustic_ctl_write(struct file *file,
        if (src[0] > max_pkg_len && src[0] != count) {
                dev_err(priv->dev, "pkg(%u), max(%u), count(%u) mismatch.\n",
                        src[0], max_pkg_len, (unsigned int)count);
-               ret = 0;
-               goto exit;
+               kfree(src);
+               return 0;
        }
 
        switch (src[1]) {
@@ -1559,14 +1559,14 @@ static ssize_t acoustic_ctl_write(struct file *file,
                break;
        default:
                dev_err(priv->dev, "%s Wrong code %02x.\n", __func__, src[1]);
-               ret = 0;
-               goto exit;
+               kfree(src);
+               return 0;
        }
 
        if (len < 1) {
                dev_err(priv->dev, "pkg fmt invalid %02x.\n", len);
-               ret = 0;
-               goto exit;
+               kfree(src);
+               return 0;
        }
 
        for (j = 0; j < priv->ndev; j++)
@@ -1576,8 +1576,8 @@ static ssize_t acoustic_ctl_write(struct file *file,
                }
        if (j >= priv->ndev) {
                dev_err(priv->dev, "no such device 0x%02x.\n", src[2]);
-               ret = 0;
-               goto exit;
+               kfree(src);
+               return 0;
        }
 
        reg = TASDEVICE_REG(src[3], src[4], src[5]);
@@ -1608,7 +1608,7 @@ static ssize_t acoustic_ctl_write(struct file *file,
                dev_err(priv->dev, "i2c communication error.\n");
        else
                ret = count;
-exit:
+
        kfree(src);
        return ret;
 }