]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: tas2781: Add null check for calibration data
authorBaojun Xu <baojun.xu@ti.com>
Thu, 19 Mar 2026 09:07:47 +0000 (17:07 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 19 Mar 2026 12:52:55 +0000 (12:52 +0000)
For avoid null pointer problem if no calibration data exist.

Fixes: 55137f5a68b5e ("ASoC: tas2781: Put three different calibrated data solution into the same data structure")
Signed-off-by: Baojun Xu <baojun.xu@ti.com>
Link: https://patch.msgid.link/20260319090747.2090-1-baojun.xu@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tas2781-fmwlib.c

index 5798d518d94cd2fb8aa19a55259f1c97e83f3146..a1d86bd309f4868327d403c8b6fbad205073c1ef 100644 (file)
@@ -2550,6 +2550,9 @@ static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i)
        int k = i * (cali_data->cali_dat_sz_per_dev + 1);
        int rc;
 
+       if (!data || !cali_data->total_sz)
+               return;
+
        if (data[k] != i) {
                dev_err(priv->dev, "%s: no cal-data for dev %d from usr-spc\n",
                        __func__, i);