Message ID | 20220702223243.51364-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v1,1/1] ASoC: Intel: catpt: remove duplicating driver data retrieval | expand |
On Sun, Jul 03, 2022 at 01:32:43AM +0300, Andy Shevchenko wrote: > device_get_match_data() in ACPI case calls similar to acpi_match_device() API. > Hence there is no need to duplicate the call. Just check what the former > returns. This patch is wrong and it's late here, and I'm blind. Sorry for the noise.
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on tiwai-sound/for-next linus/master v5.19-rc5 next-20220705]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ASoC-Intel-catpt-remove-duplicating-driver-data-retrieval/20220703-063325
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: i386-randconfig-c001 (https://download.01.org/0day-ci/archive/20220706/202207060256.1n5oG24B-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project f7a80c3d08d4821e621fc88d6a2e435291f82dff)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/a83f7416086fbf505f7f585fa3718fed2ee1ac75
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/ASoC-Intel-catpt-remove-duplicating-driver-data-retrieval/20220703-063325
git checkout a83f7416086fbf505f7f585fa3718fed2ee1ac75
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash sound/soc/intel/catpt/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> sound/soc/intel/catpt/device.c:252:45: warning: variable 'id' is uninitialized when used here [-Wuninitialized]
ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
^~
sound/soc/intel/catpt/device.c:244:33: note: initialize the variable 'id' to silence this warning
const struct acpi_device_id *id;
^
= NULL
1 warning generated.
vim +/id +252 sound/soc/intel/catpt/device.c
7a10b66a5df965 Cezary Rojewski 2020-09-29 238
7a10b66a5df965 Cezary Rojewski 2020-09-29 239 static int catpt_acpi_probe(struct platform_device *pdev)
7a10b66a5df965 Cezary Rojewski 2020-09-29 240 {
7a10b66a5df965 Cezary Rojewski 2020-09-29 241 const struct catpt_spec *spec;
7a10b66a5df965 Cezary Rojewski 2020-09-29 242 struct catpt_dev *cdev;
7a10b66a5df965 Cezary Rojewski 2020-09-29 243 struct device *dev = &pdev->dev;
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 244 const struct acpi_device_id *id;
7a10b66a5df965 Cezary Rojewski 2020-09-29 245 struct resource *res;
7a10b66a5df965 Cezary Rojewski 2020-09-29 246 int ret;
7a10b66a5df965 Cezary Rojewski 2020-09-29 247
a83f7416086fbf Andy Shevchenko 2022-07-03 248 spec = device_get_match_data(dev);
a83f7416086fbf Andy Shevchenko 2022-07-03 249 if (!spec)
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 250 return -ENODEV;
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 251
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 @252 ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 253 if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SST) {
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 254 dev_dbg(dev, "CATPT ACPI driver not selected, aborting probe\n");
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 255 return -ENODEV;
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 256 }
ec8a15d3a7c7d6 Pierre-Louis Bossart 2020-11-12 257
7a10b66a5df965 Cezary Rojewski 2020-09-29 258 cdev = devm_kzalloc(dev, sizeof(*cdev), GFP_KERNEL);
7a10b66a5df965 Cezary Rojewski 2020-09-29 259 if (!cdev)
7a10b66a5df965 Cezary Rojewski 2020-09-29 260 return -ENOMEM;
7a10b66a5df965 Cezary Rojewski 2020-09-29 261
7a10b66a5df965 Cezary Rojewski 2020-09-29 262 catpt_dev_init(cdev, dev, spec);
7a10b66a5df965 Cezary Rojewski 2020-09-29 263
7a10b66a5df965 Cezary Rojewski 2020-09-29 264 /* map DSP bar address */
7a10b66a5df965 Cezary Rojewski 2020-09-29 265 cdev->lpe_ba = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
7a10b66a5df965 Cezary Rojewski 2020-09-29 266 if (IS_ERR(cdev->lpe_ba))
7a10b66a5df965 Cezary Rojewski 2020-09-29 267 return PTR_ERR(cdev->lpe_ba);
7a10b66a5df965 Cezary Rojewski 2020-09-29 268 cdev->lpe_base = res->start;
7a10b66a5df965 Cezary Rojewski 2020-09-29 269
7a10b66a5df965 Cezary Rojewski 2020-09-29 270 /* map PCI bar address */
7a10b66a5df965 Cezary Rojewski 2020-09-29 271 cdev->pci_ba = devm_platform_ioremap_resource(pdev, 1);
7a10b66a5df965 Cezary Rojewski 2020-09-29 272 if (IS_ERR(cdev->pci_ba))
7a10b66a5df965 Cezary Rojewski 2020-09-29 273 return PTR_ERR(cdev->pci_ba);
7a10b66a5df965 Cezary Rojewski 2020-09-29 274
7a10b66a5df965 Cezary Rojewski 2020-09-29 275 /* alloc buffer for storing DRAM context during dx transitions */
7a10b66a5df965 Cezary Rojewski 2020-09-29 276 cdev->dxbuf_vaddr = dmam_alloc_coherent(dev, catpt_dram_size(cdev),
7a10b66a5df965 Cezary Rojewski 2020-09-29 277 &cdev->dxbuf_paddr, GFP_KERNEL);
7a10b66a5df965 Cezary Rojewski 2020-09-29 278 if (!cdev->dxbuf_vaddr)
7a10b66a5df965 Cezary Rojewski 2020-09-29 279 return -ENOMEM;
7a10b66a5df965 Cezary Rojewski 2020-09-29 280
7a10b66a5df965 Cezary Rojewski 2020-09-29 281 ret = platform_get_irq(pdev, 0);
7a10b66a5df965 Cezary Rojewski 2020-09-29 282 if (ret < 0)
7a10b66a5df965 Cezary Rojewski 2020-09-29 283 return ret;
7a10b66a5df965 Cezary Rojewski 2020-09-29 284 cdev->irq = ret;
7a10b66a5df965 Cezary Rojewski 2020-09-29 285
7a10b66a5df965 Cezary Rojewski 2020-09-29 286 platform_set_drvdata(pdev, cdev);
7a10b66a5df965 Cezary Rojewski 2020-09-29 287
7a10b66a5df965 Cezary Rojewski 2020-09-29 288 ret = devm_request_threaded_irq(dev, cdev->irq, catpt_dsp_irq_handler,
7a10b66a5df965 Cezary Rojewski 2020-09-29 289 catpt_dsp_irq_thread,
7a10b66a5df965 Cezary Rojewski 2020-09-29 290 IRQF_SHARED, "AudioDSP", cdev);
7a10b66a5df965 Cezary Rojewski 2020-09-29 291 if (ret)
7a10b66a5df965 Cezary Rojewski 2020-09-29 292 return ret;
7a10b66a5df965 Cezary Rojewski 2020-09-29 293
7a10b66a5df965 Cezary Rojewski 2020-09-29 294 return catpt_probe_components(cdev);
7a10b66a5df965 Cezary Rojewski 2020-09-29 295 }
7a10b66a5df965 Cezary Rojewski 2020-09-29 296
diff --git a/sound/soc/intel/catpt/device.c b/sound/soc/intel/catpt/device.c index 85a34e37316d..21856a394c3d 100644 --- a/sound/soc/intel/catpt/device.c +++ b/sound/soc/intel/catpt/device.c @@ -12,13 +12,14 @@ // helping backtrack its historical background // -#include <linux/acpi.h> #include <linux/dma-mapping.h> #include <linux/interrupt.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/property.h> #include <sound/intel-dsp-config.h> #include <sound/soc.h> #include <sound/soc-acpi.h> @@ -244,8 +245,8 @@ static int catpt_acpi_probe(struct platform_device *pdev) struct resource *res; int ret; - id = acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) + spec = device_get_match_data(dev); + if (!spec) return -ENODEV; ret = snd_intel_acpi_dsp_driver_probe(dev, id->id); @@ -254,10 +255,6 @@ static int catpt_acpi_probe(struct platform_device *pdev) return -ENODEV; } - spec = device_get_match_data(dev); - if (!spec) - return -ENODEV; - cdev = devm_kzalloc(dev, sizeof(*cdev), GFP_KERNEL); if (!cdev) return -ENOMEM;
device_get_match_data() in ACPI case calls similar to acpi_match_device() API. Hence there is no need to duplicate the call. Just check what the former returns. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- sound/soc/intel/catpt/device.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)