Re: [alsa-devel] [RESEND PATCH v5 2/6] ASoC: amd: Refactoring of DAI from DMA driver (fwd)

From: Julia Lawall
Date: Sun Nov 17 2019 - 06:05:32 EST


This code needs some work. You can't just kfree every pointer. YOu have
to consider how the pointer was initialized.

julia

---------- Forwarded message ----------
Date: Sun, 17 Nov 2019 12:48:14 +0800
From: kbuild test robot <lkp@xxxxxxxxx>
To: kbuild@xxxxxxxxxxxx
Cc: Julia Lawall <julia.lawall@xxxxxxx>
Subject: Re: [alsa-devel] [RESEND PATCH v5 2/6] ASoC: amd: Refactoring of DAI
from DMA driver

CC: kbuild-all@xxxxxxxxxxxx
In-Reply-To: <1573629249-13272-3-git-send-email-Vishnuvardhanrao.Ravulapati@xxxxxxx>
References: <1573629249-13272-3-git-send-email-Vishnuvardhanrao.Ravulapati@xxxxxxx>
CC:

Hi Ravulapati,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[cannot apply to v5.4-rc7 next-20191115]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Ravulapati-Vishnu-vardhan-rao/ASoC-amd-Create-multiple-I2S-platform-device-Endpoint/20191113-230604
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Julia Lawall <julia.lawall@xxxxxxx>

>> sound/soc/amd/raven/acp3x-i2s.c:245:1-6: WARNING: invalid free of devm_ allocated data
sound/soc/amd/raven/acp3x-i2s.c:248:1-6: WARNING: invalid free of devm_ allocated data
sound/soc/amd/raven/acp3x-i2s.c:249:1-6: WARNING: invalid free of devm_ allocated data

# https://github.com/0day-ci/linux/commit/74480eceed0f95f0b8d383d0882b918a335ce0d4
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 74480eceed0f95f0b8d383d0882b918a335ce0d4
vim +245 sound/soc/amd/raven/acp3x-i2s.c

74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 207
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 208
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 209 static int acp3x_dai_probe(struct platform_device *pdev)
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 210 {
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 211 int status;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 212 struct resource *res;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 213 struct i2s_dev_data *adata;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 214
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 215 adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data),
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 216 GFP_KERNEL);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 217 if (!adata)
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 218 return -ENOMEM;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 219
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 220 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 221 if (!res) {
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 222 dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n");
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 223 goto err;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 224 }
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 225
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 226 adata->acp3x_base = devm_ioremap(&pdev->dev, res->start,
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 227 resource_size(res));
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 228 if (IS_ERR(adata->acp3x_base))
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 229 return PTR_ERR(adata->acp3x_base);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 230
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 231 adata->i2s_irq = res->start;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 232 dev_set_drvdata(&pdev->dev, adata);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 233 status = devm_snd_soc_register_component(&pdev->dev,
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 234 &acp3x_dai_component,
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 235 &acp3x_i2s_dai, 1);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 236 if (status) {
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 237 dev_err(&pdev->dev, "Fail to register acp i2s dai\n");
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 238 goto dev_err;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 239 }
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 240 pm_runtime_set_autosuspend_delay(&pdev->dev, 10000);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 241 pm_runtime_use_autosuspend(&pdev->dev);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 242 pm_runtime_enable(&pdev->dev);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 243 return 0;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 244 err:
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 @245 kfree(adata);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 246 return -ENOMEM;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 247 dev_err:
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 248 kfree(adata->acp3x_base);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 249 kfree(adata);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 250 kfree(res);
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 251 return -ENODEV;
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 252 }
74480eceed0f95 Ravulapati Vishnu vardhan rao 2019-11-13 253

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation