sound/soc/qcom/qdsp6/topology.c:336 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
by Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1d1df41c5a33359a00e919d54eaebfb789711fdc
commit: 36ad9bf1d93d66b901342eab9f8ed6c1537655a6 ASoC: qdsp6: audioreach: add topology support
config: arc-randconfig-m031-20220117 (https://download.01.org/0day-ci/archive/20220120/202201201534.RoB5fAbP-lk...)
compiler: arceb-elf-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
New smatch warnings:
sound/soc/qcom/qdsp6/topology.c:336 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
sound/soc/qcom/qdsp6/topology.c:355 audioreach_parse_sg_tokens() error: uninitialized symbol 'sg'.
sound/soc/qcom/qdsp6/topology.c:382 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.
sound/soc/qcom/qdsp6/topology.c:402 audioreach_parse_cont_tokens() error: uninitialized symbol 'cont'.
Old smatch warnings:
sound/soc/qcom/qdsp6/topology.c:339 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
sound/soc/qcom/qdsp6/topology.c:342 audioreach_parse_sg_tokens() error: potentially dereferencing uninitialized 'sg'.
sound/soc/qcom/qdsp6/topology.c:357 audioreach_parse_sg_tokens() error: uninitialized symbol 'sg'.
sound/soc/qcom/qdsp6/topology.c:385 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.
sound/soc/qcom/qdsp6/topology.c:388 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.
sound/soc/qcom/qdsp6/topology.c:391 audioreach_parse_cont_tokens() error: potentially dereferencing uninitialized 'cont'.
vim +/sg +336 sound/soc/qcom/qdsp6/topology.c
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 303 static struct audioreach_sub_graph *audioreach_parse_sg_tokens(struct q6apm *apm,
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 304 struct snd_soc_tplg_private *private)
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 305 {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 306 struct snd_soc_tplg_vendor_value_elem *sg_elem;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 307 struct snd_soc_tplg_vendor_array *sg_array;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 308 struct audioreach_graph_info *info = NULL;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 309 int graph_id, sub_graph_id, tkn_count = 0;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 310 struct audioreach_sub_graph *sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 311 bool found;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 312
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 313 sg_array = audioreach_get_sg_array(private);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 314 sg_elem = sg_array->value;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 315
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 316 while (tkn_count <= (le32_to_cpu(sg_array->num_elems) - 1)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 317 switch (le32_to_cpu(sg_elem->token)) {
This code is very trustful of endian data. Probably that means it comes
from the firmware or something? People will file for CVEs when they
find that we're trusting firmware to be correct...
Also I really wish that some day we will be able to turn on GCC's
unitialized variable checking again. There is no way I'm going to put
up with looking through these warnings for year after year. At least
fix the W=2 uninitialized variable warnings.
sound/soc/qcom/qdsp6/topology.c:342:20: warning: ‘sg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sg->scenario_id = le32_to_cpu(sg_elem->value);
sound/soc/qcom/qdsp6/topology.c:310:31: note: ‘sg’ was declared here
struct audioreach_sub_graph *sg;
^~
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 318 case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 319 sub_graph_id = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 320 sg = audioreach_tplg_alloc_sub_graph(apm, sub_graph_id, &found);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 321 if (IS_ERR(sg)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 322 return sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 323 } else if (found) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 324 /* Already parsed data for this sub-graph */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 325 return sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 326 }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 327 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 328 case AR_TKN_DAI_INDEX:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 329 /* Sub graph is associated with predefined graph */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 330 graph_id = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 331 info = audioreach_tplg_alloc_graph_info(apm, graph_id, &found);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 332 if (IS_ERR(info))
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 333 return ERR_CAST(info);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 334 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 335 case AR_TKN_U32_SUB_GRAPH_PERF_MODE:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @336 sg->perf_mode = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 337 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 338 case AR_TKN_U32_SUB_GRAPH_DIRECTION:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 339 sg->direction = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 340 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 341 case AR_TKN_U32_SUB_GRAPH_SCENARIO_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 342 sg->scenario_id = le32_to_cpu(sg_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 343 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 344 default:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 345 dev_err(apm->dev, "Not a valid token %d for graph\n", sg_elem->token);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 346 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 347
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 348 }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 349 tkn_count++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 350 sg_elem++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 351 }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 352
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 353 /* Sub graph is associated with predefined graph */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 354 if (info)
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @355 audioreach_tplg_add_sub_graph(sg, info);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 356
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 357 return sg;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 358 }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 359
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 360 static struct audioreach_container *audioreach_parse_cont_tokens(struct q6apm *apm,
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 361 struct audioreach_sub_graph *sg,
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 362 struct snd_soc_tplg_private *private)
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 363 {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 364 struct snd_soc_tplg_vendor_value_elem *cont_elem;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 365 struct snd_soc_tplg_vendor_array *cont_array;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 366 struct audioreach_container *cont;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 367 int container_id, tkn_count = 0;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 368 bool found = false;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 369
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 370 cont_array = audioreach_get_cont_array(private);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 371 cont_elem = cont_array->value;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 372
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 373 while (tkn_count <= (le32_to_cpu(cont_array->num_elems) - 1)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 374 switch (le32_to_cpu(cont_elem->token)) {
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 375 case AR_TKN_U32_CONTAINER_INSTANCE_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 376 container_id = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 377 cont = audioreach_tplg_alloc_container(apm, sg, container_id, &found);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 378 if (IS_ERR(cont) || found)/* Error or Already parsed container data */
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 379 return cont;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 380 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 381 case AR_TKN_U32_CONTAINER_CAPABILITY_ID:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @382 cont->capability_id = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 383 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 384 case AR_TKN_U32_CONTAINER_STACK_SIZE:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 385 cont->stack_size = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 386 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 387 case AR_TKN_U32_CONTAINER_GRAPH_POS:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 388 cont->graph_pos = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 389 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 390 case AR_TKN_U32_CONTAINER_PROC_DOMAIN:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 391 cont->proc_domain = le32_to_cpu(cont_elem->value);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 392 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 393 default:
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 394 dev_err(apm->dev, "Not a valid token %d for graph\n", cont_elem->token);
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 395 break;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 396
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 397 }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 398 tkn_count++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 399 cont_elem++;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 400 }
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 401
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 @402 return cont;
36ad9bf1d93d66 Srinivas Kandagatla 2021-10-26 403 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
drivers/dma-buf/heaps/system_heap.c:357:24: warning: returning 'int' from a function with return type 'struct dma_buf *' makes pointer from integer without a cast
by kernel test robot
tree: https://github.com/0day-ci/linux/commits/UPDATE-20220120-113516/guangming...
head: d6d3f09d899553b1100b195a91a8f718d1bd6bc2
commit: d6d3f09d899553b1100b195a91a8f718d1bd6bc2 dma-buf: system_heap: Add a size check for allocation
date: 3 hours ago
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20220120/202201201448.vJ5izfFs-lk...)
compiler: mips-linux-gcc (GCC) 11.2.0
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/0day-ci/linux/commit/d6d3f09d899553b1100b195a91a8f718d...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20220120-113516/guangming-cao-mediatek-com/dma-buf-dma-heap-Add-a-size-limitation-for-allocation/20211217-174135
git checkout d6d3f09d899553b1100b195a91a8f718d1bd6bc2
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/dma-buf/heaps/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/dma-buf/heaps/system_heap.c: In function 'system_heap_allocate':
>> drivers/dma-buf/heaps/system_heap.c:357:24: warning: returning 'int' from a function with return type 'struct dma_buf *' makes pointer from integer without a cast [-Wint-conversion]
357 | return -EINVAL;
| ^
vim +357 drivers/dma-buf/heaps/system_heap.c
334
335 static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
336 unsigned long len,
337 unsigned long fd_flags,
338 unsigned long heap_flags)
339 {
340 struct system_heap_buffer *buffer;
341 DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
342 unsigned long size_remaining = len;
343 unsigned int max_order = orders[0];
344 struct dma_buf *dmabuf;
345 struct sg_table *table;
346 struct scatterlist *sg;
347 struct list_head pages;
348 struct page *page, *tmp_page;
349 int i, ret = -ENOMEM;
350
351 /*
352 * Size check. The "len" should be less than totalram since system_heap
353 * memory is comes from system. Adding check here can prevent consuming
354 * too much time for invalid allocations.
355 */
356 if (len >> PAGE_SHIFT > totalram_pages())
> 357 return -EINVAL;
358 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
359 if (!buffer)
360 return ERR_PTR(-ENOMEM);
361
362 INIT_LIST_HEAD(&buffer->attachments);
363 mutex_init(&buffer->lock);
364 buffer->heap = heap;
365 buffer->len = len;
366
367 INIT_LIST_HEAD(&pages);
368 i = 0;
369 while (size_remaining > 0) {
370 /*
371 * Avoid trying to allocate memory if the process
372 * has been killed by SIGKILL
373 */
374 if (fatal_signal_pending(current)) {
375 ret = -EINTR;
376 goto free_buffer;
377 }
378
379 page = alloc_largest_available(size_remaining, max_order);
380 if (!page)
381 goto free_buffer;
382
383 list_add_tail(&page->lru, &pages);
384 size_remaining -= page_size(page);
385 max_order = compound_order(page);
386 i++;
387 }
388
389 table = &buffer->sg_table;
390 if (sg_alloc_table(table, i, GFP_KERNEL))
391 goto free_buffer;
392
393 sg = table->sgl;
394 list_for_each_entry_safe(page, tmp_page, &pages, lru) {
395 sg_set_page(sg, page, page_size(page), 0);
396 sg = sg_next(sg);
397 list_del(&page->lru);
398 }
399
400 /* create the dmabuf */
401 exp_info.exp_name = dma_heap_get_name(heap);
402 exp_info.ops = &system_heap_buf_ops;
403 exp_info.size = buffer->len;
404 exp_info.flags = fd_flags;
405 exp_info.priv = buffer;
406 dmabuf = dma_buf_export(&exp_info);
407 if (IS_ERR(dmabuf)) {
408 ret = PTR_ERR(dmabuf);
409 goto free_pages;
410 }
411 return dmabuf;
412
413 free_pages:
414 for_each_sgtable_sg(table, sg, i) {
415 struct page *p = sg_page(sg);
416
417 __free_pages(p, compound_order(p));
418 }
419 sg_free_table(table);
420 free_buffer:
421 list_for_each_entry_safe(page, tmp_page, &pages, lru)
422 __free_pages(page, compound_order(page));
423 kfree(buffer);
424
425 return ERR_PTR(ret);
426 }
427
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
drivers/dma-buf/heaps/system_heap.c:357:10: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'struct dma_buf *'
by kernel test robot
tree: https://github.com/0day-ci/linux/commits/UPDATE-20220120-113516/guangming...
head: d6d3f09d899553b1100b195a91a8f718d1bd6bc2
commit: d6d3f09d899553b1100b195a91a8f718d1bd6bc2 dma-buf: system_heap: Add a size check for allocation
date: 3 hours ago
config: x86_64-randconfig-a001-20220117 (https://download.01.org/0day-ci/archive/20220120/202201201459.LzpimBE3-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f7b7138a62648f4019c55e4671682af1f851f295)
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/0day-ci/linux/commit/d6d3f09d899553b1100b195a91a8f718d...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20220120-113516/guangming-cao-mediatek-com/dma-buf-dma-heap-Add-a-size-limitation-for-allocation/20211217-174135
git checkout d6d3f09d899553b1100b195a91a8f718d1bd6bc2
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/dma-buf/heaps/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/dma-buf/heaps/system_heap.c:357:10: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'struct dma_buf *' [-Wint-conversion]
return -EINVAL;
^~~~~~~
1 warning generated.
vim +357 drivers/dma-buf/heaps/system_heap.c
334
335 static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
336 unsigned long len,
337 unsigned long fd_flags,
338 unsigned long heap_flags)
339 {
340 struct system_heap_buffer *buffer;
341 DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
342 unsigned long size_remaining = len;
343 unsigned int max_order = orders[0];
344 struct dma_buf *dmabuf;
345 struct sg_table *table;
346 struct scatterlist *sg;
347 struct list_head pages;
348 struct page *page, *tmp_page;
349 int i, ret = -ENOMEM;
350
351 /*
352 * Size check. The "len" should be less than totalram since system_heap
353 * memory is comes from system. Adding check here can prevent consuming
354 * too much time for invalid allocations.
355 */
356 if (len >> PAGE_SHIFT > totalram_pages())
> 357 return -EINVAL;
358 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
359 if (!buffer)
360 return ERR_PTR(-ENOMEM);
361
362 INIT_LIST_HEAD(&buffer->attachments);
363 mutex_init(&buffer->lock);
364 buffer->heap = heap;
365 buffer->len = len;
366
367 INIT_LIST_HEAD(&pages);
368 i = 0;
369 while (size_remaining > 0) {
370 /*
371 * Avoid trying to allocate memory if the process
372 * has been killed by SIGKILL
373 */
374 if (fatal_signal_pending(current)) {
375 ret = -EINTR;
376 goto free_buffer;
377 }
378
379 page = alloc_largest_available(size_remaining, max_order);
380 if (!page)
381 goto free_buffer;
382
383 list_add_tail(&page->lru, &pages);
384 size_remaining -= page_size(page);
385 max_order = compound_order(page);
386 i++;
387 }
388
389 table = &buffer->sg_table;
390 if (sg_alloc_table(table, i, GFP_KERNEL))
391 goto free_buffer;
392
393 sg = table->sgl;
394 list_for_each_entry_safe(page, tmp_page, &pages, lru) {
395 sg_set_page(sg, page, page_size(page), 0);
396 sg = sg_next(sg);
397 list_del(&page->lru);
398 }
399
400 /* create the dmabuf */
401 exp_info.exp_name = dma_heap_get_name(heap);
402 exp_info.ops = &system_heap_buf_ops;
403 exp_info.size = buffer->len;
404 exp_info.flags = fd_flags;
405 exp_info.priv = buffer;
406 dmabuf = dma_buf_export(&exp_info);
407 if (IS_ERR(dmabuf)) {
408 ret = PTR_ERR(dmabuf);
409 goto free_pages;
410 }
411 return dmabuf;
412
413 free_pages:
414 for_each_sgtable_sg(table, sg, i) {
415 struct page *p = sg_page(sg);
416
417 __free_pages(p, compound_order(p));
418 }
419 sg_free_table(table);
420 free_buffer:
421 list_for_each_entry_safe(page, tmp_page, &pages, lru)
422 __free_pages(page, compound_order(page));
423 kfree(buffer);
424
425 return ERR_PTR(ret);
426 }
427
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
[esmil:visionfive-5.16.y 61/80] drivers/net/phy/motorcomm.c:163:5: warning: no previous prototype for 'genphy_config_init'
by kernel test robot
tree: https://github.com/esmil/linux visionfive-5.16.y
head: eeeb46a916e77aecbe1699537a5592746f3130f6
commit: d4993dd33c50b5ea0db8f5a8cdcd0dee5458b299 [61/80] net: phy: motorcomm: Support the YT8521 gigabit PHY
config: ia64-randconfig-r021-20220116 (https://download.01.org/0day-ci/archive/20220119/202201190351.34Nj9vc7-lk...)
compiler: ia64-linux-gcc (GCC) 11.2.0
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/esmil/linux/commit/d4993dd33c50b5ea0db8f5a8cdcd0dee545...
git remote add esmil https://github.com/esmil/linux
git fetch --no-tags esmil visionfive-5.16.y
git checkout d4993dd33c50b5ea0db8f5a8cdcd0dee5458b299
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/net/phy/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from arch/ia64/include/asm/pgtable.h:153,
from include/linux/pgtable.h:6,
from arch/ia64/include/asm/uaccess.h:40,
from include/linux/uaccess.h:11,
from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs.h:33,
from include/linux/compat.h:17,
from include/linux/ethtool.h:17,
from include/linux/phy.h:16,
from drivers/net/phy/motorcomm.c:10:
arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
127 | unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
| ^~~~~~~
drivers/net/phy/motorcomm.c: At top level:
>> drivers/net/phy/motorcomm.c:163:5: warning: no previous prototype for 'genphy_config_init' [-Wmissing-prototypes]
163 | int genphy_config_init(struct phy_device *phydev)
| ^~~~~~~~~~~~~~~~~~
>> drivers/net/phy/motorcomm.c:195:5: warning: no previous prototype for 'yt8521_soft_reset' [-Wmissing-prototypes]
195 | int yt8521_soft_reset(struct phy_device *phydev)
| ^~~~~~~~~~~~~~~~~
>> drivers/net/phy/motorcomm.c:484:5: warning: no previous prototype for 'yt8521_suspend' [-Wmissing-prototypes]
484 | int yt8521_suspend(struct phy_device *phydev)
| ^~~~~~~~~~~~~~
>> drivers/net/phy/motorcomm.c:503:5: warning: no previous prototype for 'yt8521_resume' [-Wmissing-prototypes]
503 | int yt8521_resume(struct phy_device *phydev)
| ^~~~~~~~~~~~~
drivers/net/phy/motorcomm.c:14:33: warning: initialized field overwritten [-Woverride-init]
14 | #define MOTORCOMM_PHY_ID_MASK 0x00000fff
| ^~~~~~~~~~
drivers/net/phy/motorcomm.c:556:35: note: in expansion of macro 'MOTORCOMM_PHY_ID_MASK'
556 | .phy_id_mask = MOTORCOMM_PHY_ID_MASK,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/net/phy/motorcomm.c:14:33: note: (near initialization for 'motorcomm_phy_drvs[1].phy_id_mask')
14 | #define MOTORCOMM_PHY_ID_MASK 0x00000fff
| ^~~~~~~~~~
drivers/net/phy/motorcomm.c:556:35: note: in expansion of macro 'MOTORCOMM_PHY_ID_MASK'
556 | .phy_id_mask = MOTORCOMM_PHY_ID_MASK,
| ^~~~~~~~~~~~~~~~~~~~~
vim +/genphy_config_init +163 drivers/net/phy/motorcomm.c
> 10 #include <linux/phy.h>
11
12 #define PHY_ID_YT8511 0x0000010a
13 #define PHY_ID_YT8521 0x0000011a
14 #define MOTORCOMM_PHY_ID_MASK 0x00000fff
15
16 #define YT8511_PAGE_SELECT 0x1e
17 #define YT8511_PAGE 0x1f
18 #define YT8511_EXT_CLK_GATE 0x0c
19 #define YT8511_EXT_DELAY_DRIVE 0x0d
20 #define YT8511_EXT_SLEEP_CTRL 0x27
21
22 /* 2b00 25m from pll
23 * 2b01 25m from xtl *default*
24 * 2b10 62.m from pll
25 * 2b11 125m from pll
26 */
27 #define YT8511_CLK_125M (BIT(2) | BIT(1))
28 #define YT8511_PLLON_SLP BIT(14)
29
30 /* RX Delay enabled = 1.8ns 1000T, 8ns 10/100T */
31 #define YT8511_DELAY_RX BIT(0)
32
33 /* TX Gig-E Delay is bits 7:4, default 0x5
34 * TX Fast-E Delay is bits 15:12, default 0xf
35 * Delay = 150ps * N - 250ps
36 * On = 2000ps, off = 50ps
37 */
38 #define YT8511_DELAY_GE_TX_EN (0xf << 4)
39 #define YT8511_DELAY_GE_TX_DIS (0x2 << 4)
40 #define YT8511_DELAY_FE_TX_EN (0xf << 12)
41 #define YT8511_DELAY_FE_TX_DIS (0x2 << 12)
42
43 #define YT8521_SLEEP_SW_EN BIT(15)
44 #define YT8521_LINK_STATUS BIT(10)
45 #define YT8521_DUPLEX 0x2000
46 #define YT8521_SPEED_MODE 0xc000
47 #define YTPHY_REG_SPACE_UTP 0
48 #define YTPHY_REG_SPACE_FIBER 2
49 #define REG_PHY_SPEC_STATUS 0x11
50 /* based on yt8521 wol config register */
51 #define YTPHY_UTP_INTR_REG 0x12
52
53 #define SYS_WAKEUP_BASED_ON_ETH_PKT 0
54
55 /* to enable system WOL of phy, please define this macro to 1
56 * otherwise, define it to 0.
57 */
58 #define YTPHY_ENABLE_WOL 0
59
60 #if (YTPHY_ENABLE_WOL)
61 #undef SYS_WAKEUP_BASED_ON_ETH_PKT
62 #define SYS_WAKEUP_BASED_ON_ETH_PKT 1
63 #endif
64
65 #if (YTPHY_ENABLE_WOL)
66 enum ytphy_wol_type_e {
67 YTPHY_WOL_TYPE_LEVEL,
68 YTPHY_WOL_TYPE_PULSE,
69 YTPHY_WOL_TYPE_MAX
70 };
71 typedef enum ytphy_wol_type_e ytphy_wol_type_t;
72
73 enum ytphy_wol_width_e {
74 YTPHY_WOL_WIDTH_84MS,
75 YTPHY_WOL_WIDTH_168MS,
76 YTPHY_WOL_WIDTH_336MS,
77 YTPHY_WOL_WIDTH_672MS,
78 YTPHY_WOL_WIDTH_MAX
79 };
80 typedef enum ytphy_wol_width_e ytphy_wol_width_t;
81
82 struct ytphy_wol_cfg_s {
83 int enable;
84 int type;
85 int width;
86 };
87 typedef struct ytphy_wol_cfg_s ytphy_wol_cfg_t;
88 #endif /*(YTPHY_ENABLE_WOL)*/
89
90 static int yt8511_read_page(struct phy_device *phydev)
91 {
92 return __phy_read(phydev, YT8511_PAGE_SELECT);
93 };
94
95 static int yt8511_write_page(struct phy_device *phydev, int page)
96 {
97 return __phy_write(phydev, YT8511_PAGE_SELECT, page);
98 };
99
100 static int yt8511_config_init(struct phy_device *phydev)
101 {
102 int oldpage, ret = 0;
103 unsigned int ge, fe;
104
105 oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
106 if (oldpage < 0)
107 goto err_restore_page;
108
109 /* set rgmii delay mode */
110 switch (phydev->interface) {
111 case PHY_INTERFACE_MODE_RGMII:
112 ge = YT8511_DELAY_GE_TX_DIS;
113 fe = YT8511_DELAY_FE_TX_DIS;
114 break;
115 case PHY_INTERFACE_MODE_RGMII_RXID:
116 ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_DIS;
117 fe = YT8511_DELAY_FE_TX_DIS;
118 break;
119 case PHY_INTERFACE_MODE_RGMII_TXID:
120 ge = YT8511_DELAY_GE_TX_EN;
121 fe = YT8511_DELAY_FE_TX_EN;
122 break;
123 case PHY_INTERFACE_MODE_RGMII_ID:
124 ge = YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN;
125 fe = YT8511_DELAY_FE_TX_EN;
126 break;
127 default: /* do not support other modes */
128 ret = -EOPNOTSUPP;
129 goto err_restore_page;
130 }
131
132 ret = __phy_modify(phydev, YT8511_PAGE, (YT8511_DELAY_RX | YT8511_DELAY_GE_TX_EN), ge);
133 if (ret < 0)
134 goto err_restore_page;
135
136 /* set clock mode to 125mhz */
137 ret = __phy_modify(phydev, YT8511_PAGE, 0, YT8511_CLK_125M);
138 if (ret < 0)
139 goto err_restore_page;
140
141 /* fast ethernet delay is in a separate page */
142 ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_DELAY_DRIVE);
143 if (ret < 0)
144 goto err_restore_page;
145
146 ret = __phy_modify(phydev, YT8511_PAGE, YT8511_DELAY_FE_TX_EN, fe);
147 if (ret < 0)
148 goto err_restore_page;
149
150 /* leave pll enabled in sleep */
151 ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
152 if (ret < 0)
153 goto err_restore_page;
154
155 ret = __phy_modify(phydev, YT8511_PAGE, 0, YT8511_PLLON_SLP);
156 if (ret < 0)
157 goto err_restore_page;
158
159 err_restore_page:
160 return phy_restore_page(phydev, oldpage, ret);
161 }
162
> 163 int genphy_config_init(struct phy_device *phydev)
164 {
165 return genphy_read_abilities(phydev);
166 }
167
168 static int ytphy_read_ext(struct phy_device *phydev, u32 regnum)
169 {
170 int ret;
171 int val;
172
173 ret = phy_write(phydev, YT8511_PAGE_SELECT, regnum);
174 if (ret < 0)
175 return ret;
176
177 val = phy_read(phydev, YT8511_PAGE);
178
179 return val;
180 }
181
182 static int ytphy_write_ext(struct phy_device *phydev, u32 regnum, u16 val)
183 {
184 int ret;
185
186 ret = phy_write(phydev, YT8511_PAGE_SELECT, regnum);
187 if (ret < 0)
188 return ret;
189
190 ret = phy_write(phydev, YT8511_PAGE, val);
191
192 return ret;
193 }
194
> 195 int yt8521_soft_reset(struct phy_device *phydev)
196 {
197 int ret, val;
198
199 val = ytphy_read_ext(phydev, 0xa001);
200 ytphy_write_ext(phydev, 0xa001, (val & ~0x8000));
201
202 ret = genphy_soft_reset(phydev);
203 if (ret < 0)
204 return ret;
205
206 return 0;
207 }
208
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
[chrome-os:chromeos-5.10 9952/9999] sound/soc/sof/mediatek/mt8195/mt8195.c:545:28: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'size_t' {aka 'long unsigned int'}
by kernel test robot
tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.10
head: 07b8fbc674e48cc26b616d7f880d427dc37e3a7b
commit: ac3fa3878aca1e098e64cf9b41ee01a4b8365d01 [9952/9999] CHROMIUM: ASoC: SOF: mediatek: Add mt8195 dsp pcm stream callback
config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20220120/202201201218.rnPrULXO-lk...)
compiler: ia64-linux-gcc (GCC) 11.2.0
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
git remote add chrome-os https://chromium.googlesource.com/chromiumos/third_party/kernel
git fetch --no-tags chrome-os chromeos-5.10
git checkout ac3fa3878aca1e098e64cf9b41ee01a4b8365d01
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash sound/soc/sof/mediatek/mt8195/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:409,
from include/linux/kernel.h:16,
from include/linux/delay.h:22,
from sound/soc/sof/mediatek/mt8195/mt8195.c:12:
sound/soc/sof/mediatek/mt8195/mt8195.c: In function 'mt8195_ipc_pcm_params':
>> sound/soc/sof/mediatek/mt8195/mt8195.c:545:28: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
545 | dev_dbg(sdev->dev, "pcm: stream dir %d, posn mailbox offset is 0x%x",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:129:29: note: in definition of macro '__dynamic_func_call'
129 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:161:9: note: in expansion of macro '_dynamic_func_call'
161 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:9: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:30: note: in expansion of macro 'dev_fmt'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
sound/soc/sof/mediatek/mt8195/mt8195.c:545:9: note: in expansion of macro 'dev_dbg'
545 | dev_dbg(sdev->dev, "pcm: stream dir %d, posn mailbox offset is 0x%x",
| ^~~~~~~
sound/soc/sof/mediatek/mt8195/mt8195.c:545:75: note: format string is defined here
545 | dev_dbg(sdev->dev, "pcm: stream dir %d, posn mailbox offset is 0x%x",
| ~^
| |
| unsigned int
| %lx
vim +545 sound/soc/sof/mediatek/mt8195/mt8195.c
530
531 static int mt8195_ipc_pcm_params(struct snd_sof_dev *sdev,
532 struct snd_pcm_substream *substream,
533 const struct sof_ipc_pcm_params_reply *reply)
534 {
535 struct sof_mtk_adsp_stream *mstream = substream->runtime->private_data;
536 size_t posn_offset = reply->posn_offset;
537
538 /* check for unaligned offset or overflow */
539 if (posn_offset > sdev->stream_box.size ||
540 posn_offset % sizeof(struct sof_ipc_stream_posn) != 0)
541 return -EINVAL;
542
543 mstream->stream.posn_offset = sdev->stream_box.offset + posn_offset;
544
> 545 dev_dbg(sdev->dev, "pcm: stream dir %d, posn mailbox offset is 0x%x",
546 substream->stream, mstream->stream.posn_offset);
547
548 return 0;
549 }
550
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
Re: [PATCH][next] ALSA: usb-audio: scarlett2: Use struct_size() helper in scarlett2_usb()
by kernel test robot
Hi "Gustavo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on v5.16 next-20220118]
[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/0day-ci/linux/commits/Gustavo-A-R-Silva/ALSA-usb-audio...
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: i386-randconfig-a003-20220117 (https://download.01.org/0day-ci/archive/20220120/202201201212.O8wvhLQc-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f7b7138a62648f4019c55e4671682af1f851f295)
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/0day-ci/linux/commit/1696152f12c0a7d23ccd5e228f9d08f7b...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Gustavo-A-R-Silva/ALSA-usb-audio-scarlett2-Use-struct_size-helper-in-scarlett2_usb/20220120-080908
git checkout 1696152f12c0a7d23ccd5e228f9d08f7bd2da83a
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash sound/usb/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> sound/usb/mixer_scarlett_gen2.c:1115:14: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
cmd, err, resp_buf_size);
^~~~~~~~~~~~~
sound/usb/usbaudio.h:67:36: note: expanded from macro 'usb_audio_err'
dev_err(&(chip)->dev->dev, fmt, ##args)
~~~ ^~~~
include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
1 warning generated.
vim +1115 sound/usb/mixer_scarlett_gen2.c
1f7fa6e5afbf20 Geoffrey D. Bennett 2021-06-22 1056
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1057 /* Send a proprietary format request to the Scarlett interface */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1058 static int scarlett2_usb(
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1059 struct usb_mixer_interface *mixer, u32 cmd,
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1060 void *req_data, u16 req_size, void *resp_data, u16 resp_size)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1061 {
e46f2195c86b00 Geoffrey D. Bennett 2021-06-21 1062 struct scarlett2_data *private = mixer->private_data;
1f7fa6e5afbf20 Geoffrey D. Bennett 2021-06-22 1063 struct usb_device *dev = mixer->chip->dev;
b677b6c6d82248 Geoffrey D. Bennett 2021-06-21 1064 struct scarlett2_usb_packet *req, *resp = NULL;
1696152f12c0a7 Gustavo A. R. Silva 2022-01-19 1065 size_t req_buf_size = struct_size(req, data, req_size);
1696152f12c0a7 Gustavo A. R. Silva 2022-01-19 1066 size_t resp_buf_size = struct_size(resp, data, resp_size);
b677b6c6d82248 Geoffrey D. Bennett 2021-06-21 1067 int err;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1068
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1069 req = kmalloc(req_buf_size, GFP_KERNEL);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1070 if (!req) {
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1071 err = -ENOMEM;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1072 goto error;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1073 }
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1074
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1075 resp = kmalloc(resp_buf_size, GFP_KERNEL);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1076 if (!resp) {
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1077 err = -ENOMEM;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1078 goto error;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1079 }
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1080
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1081 mutex_lock(&private->usb_mutex);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1082
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1083 /* build request message and send it */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1084
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1085 scarlett2_fill_request_header(private, req, cmd, req_size);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1086
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1087 if (req_size)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1088 memcpy(req->data, req_data, req_size);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1089
1f7fa6e5afbf20 Geoffrey D. Bennett 2021-06-22 1090 err = scarlett2_usb_tx(dev, private->bInterfaceNumber,
1f7fa6e5afbf20 Geoffrey D. Bennett 2021-06-22 1091 req, req_buf_size);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1092
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1093 if (err != req_buf_size) {
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1094 usb_audio_err(
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1095 mixer->chip,
4be47798d76e6e Geoffrey D. Bennett 2021-06-23 1096 "Scarlett Gen 2/3 USB request result cmd %x was %d\n",
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1097 cmd, err);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1098 err = -EINVAL;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1099 goto unlock;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1100 }
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1101
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1102 /* send a second message to get the response */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1103
1f7fa6e5afbf20 Geoffrey D. Bennett 2021-06-22 1104 err = scarlett2_usb_rx(dev, private->bInterfaceNumber,
1f7fa6e5afbf20 Geoffrey D. Bennett 2021-06-22 1105 SCARLETT2_USB_CMD_RESP,
1f7fa6e5afbf20 Geoffrey D. Bennett 2021-06-22 1106 resp, resp_buf_size);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1107
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1108 /* validate the response */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1109
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1110 if (err != resp_buf_size) {
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1111 usb_audio_err(
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1112 mixer->chip,
4be47798d76e6e Geoffrey D. Bennett 2021-06-23 1113 "Scarlett Gen 2/3 USB response result cmd %x was %d "
1696152f12c0a7 Gustavo A. R. Silva 2022-01-19 1114 "expected %lu\n",
acf91b8122c7f6 Geoffrey D. Bennett 2021-06-22 @1115 cmd, err, resp_buf_size);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1116 err = -EINVAL;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1117 goto unlock;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1118 }
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1119
acf91b8122c7f6 Geoffrey D. Bennett 2021-06-22 1120 /* cmd/seq/size should match except when initialising
acf91b8122c7f6 Geoffrey D. Bennett 2021-06-22 1121 * seq sent = 1, response = 0
acf91b8122c7f6 Geoffrey D. Bennett 2021-06-22 1122 */
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1123 if (resp->cmd != req->cmd ||
acf91b8122c7f6 Geoffrey D. Bennett 2021-06-22 1124 (resp->seq != req->seq &&
acf91b8122c7f6 Geoffrey D. Bennett 2021-06-22 1125 (le16_to_cpu(req->seq) != 1 || resp->seq != 0)) ||
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1126 resp_size != le16_to_cpu(resp->size) ||
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1127 resp->error ||
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1128 resp->pad) {
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1129 usb_audio_err(
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1130 mixer->chip,
4be47798d76e6e Geoffrey D. Bennett 2021-06-23 1131 "Scarlett Gen 2/3 USB invalid response; "
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1132 "cmd tx/rx %d/%d seq %d/%d size %d/%d "
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1133 "error %d pad %d\n",
d8f489355cff55 Takashi Iwai 2020-02-01 1134 le32_to_cpu(req->cmd), le32_to_cpu(resp->cmd),
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1135 le16_to_cpu(req->seq), le16_to_cpu(resp->seq),
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1136 resp_size, le16_to_cpu(resp->size),
d8f489355cff55 Takashi Iwai 2020-02-01 1137 le32_to_cpu(resp->error),
d8f489355cff55 Takashi Iwai 2020-02-01 1138 le32_to_cpu(resp->pad));
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1139 err = -EINVAL;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1140 goto unlock;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1141 }
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1142
acf91b8122c7f6 Geoffrey D. Bennett 2021-06-22 1143 if (resp_data && resp_size > 0)
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1144 memcpy(resp_data, resp->data, resp_size);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1145
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1146 unlock:
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1147 mutex_unlock(&private->usb_mutex);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1148 error:
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1149 kfree(req);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1150 kfree(resp);
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1151 return err;
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1152 }
9e4d5c1be21f0c Geoffrey D. Bennett 2019-07-29 1153
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
Re: [PATCH v5 3/4] drm/bridge: anx7625: Support reading edid through aux channel
by kernel test robot
Hi Hsin-Yi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-tip/drm-tip]
[cannot apply to drm/drm-next robh/for-next drm-intel/for-linux-next v5.16 next-20220118]
[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/0day-ci/linux/commits/Hsin-Yi-Wang/drm-bridge-anx7625-...
base: git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: i386-randconfig-r024-20220117 (https://download.01.org/0day-ci/archive/20220120/202201201223.sts9AtBC-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/61809df270082584886188b067ee19744...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Hsin-Yi-Wang/drm-bridge-anx7625-send-DPCD-command-to-downstream/20220119-231952
git checkout 61809df270082584886188b067ee19744f4b35e1
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
ld: drivers/gpu/drm/bridge/analogix/anx7625.o: in function `anx7625_i2c_probe':
>> drivers/gpu/drm/bridge/analogix/anx7625.c:2648: undefined reference to `devm_of_dp_aux_populate_ep_devices'
vim +2648 drivers/gpu/drm/bridge/analogix/anx7625.c
2574
2575 static int anx7625_i2c_probe(struct i2c_client *client,
2576 const struct i2c_device_id *id)
2577 {
2578 struct anx7625_data *platform;
2579 struct anx7625_platform_data *pdata;
2580 int ret = 0;
2581 struct device *dev = &client->dev;
2582
2583 if (!i2c_check_functionality(client->adapter,
2584 I2C_FUNC_SMBUS_I2C_BLOCK)) {
2585 DRM_DEV_ERROR(dev, "anx7625's i2c bus doesn't support\n");
2586 return -ENODEV;
2587 }
2588
2589 platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
2590 if (!platform) {
2591 DRM_DEV_ERROR(dev, "fail to allocate driver data\n");
2592 return -ENOMEM;
2593 }
2594
2595 pdata = &platform->pdata;
2596
2597 platform->client = client;
2598 i2c_set_clientdata(client, platform);
2599
2600 pdata->supplies[0].supply = "vdd10";
2601 pdata->supplies[1].supply = "vdd18";
2602 pdata->supplies[2].supply = "vdd33";
2603 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(pdata->supplies),
2604 pdata->supplies);
2605 if (ret) {
2606 DRM_DEV_ERROR(dev, "fail to get power supplies: %d\n", ret);
2607 return ret;
2608 }
2609 anx7625_init_gpio(platform);
2610
2611 mutex_init(&platform->lock);
2612 mutex_init(&platform->hdcp_wq_lock);
2613
2614 INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func);
2615 platform->hdcp_workqueue = create_workqueue("hdcp workqueue");
2616 if (!platform->hdcp_workqueue) {
2617 dev_err(dev, "fail to create work queue\n");
2618 ret = -ENOMEM;
2619 return ret;
2620 }
2621
2622 platform->pdata.intp_irq = client->irq;
2623 if (platform->pdata.intp_irq) {
2624 INIT_WORK(&platform->work, anx7625_work_func);
2625 platform->workqueue = alloc_workqueue("anx7625_work",
2626 WQ_FREEZABLE | WQ_MEM_RECLAIM, 1);
2627 if (!platform->workqueue) {
2628 DRM_DEV_ERROR(dev, "fail to create work queue\n");
2629 ret = -ENOMEM;
2630 goto free_hdcp_wq;
2631 }
2632
2633 ret = devm_request_threaded_irq(dev, platform->pdata.intp_irq,
2634 NULL, anx7625_intr_hpd_isr,
2635 IRQF_TRIGGER_FALLING |
2636 IRQF_ONESHOT,
2637 "anx7625-intp", platform);
2638 if (ret) {
2639 DRM_DEV_ERROR(dev, "fail to request irq\n");
2640 goto free_wq;
2641 }
2642 }
2643
2644 platform->aux.name = "anx7625-aux";
2645 platform->aux.dev = dev;
2646 platform->aux.transfer = anx7625_aux_transfer;
2647 drm_dp_aux_init(&platform->aux);
> 2648 devm_of_dp_aux_populate_ep_devices(&platform->aux);
2649
2650 ret = anx7625_parse_dt(dev, pdata);
2651 if (ret) {
2652 if (ret != -EPROBE_DEFER)
2653 DRM_DEV_ERROR(dev, "fail to parse DT : %d\n", ret);
2654 return ret;
2655 }
2656
2657 if (anx7625_register_i2c_dummy_clients(platform, client) != 0) {
2658 ret = -ENOMEM;
2659 DRM_DEV_ERROR(dev, "fail to reserve I2C bus.\n");
2660 goto free_wq;
2661 }
2662
2663 pm_runtime_enable(dev);
2664 pm_runtime_set_autosuspend_delay(dev, 1000);
2665 pm_runtime_use_autosuspend(dev);
2666 pm_suspend_ignore_children(dev, true);
2667 ret = devm_add_action_or_reset(dev, anx7625_runtime_disable, dev);
2668 if (ret)
2669 return ret;
2670
2671 if (!platform->pdata.low_power_mode) {
2672 anx7625_disable_pd_protocol(platform);
2673 pm_runtime_get_sync(dev);
2674 }
2675
2676 /* Add work function */
2677 if (platform->pdata.intp_irq)
2678 queue_work(platform->workqueue, &platform->work);
2679
2680 platform->bridge.funcs = &anx7625_bridge_funcs;
2681 platform->bridge.of_node = client->dev.of_node;
2682 if (!anx7625_of_panel_on_aux_bus(&client->dev))
2683 platform->bridge.ops |= DRM_BRIDGE_OP_EDID;
2684 if (!platform->pdata.panel_bridge)
2685 platform->bridge.ops |= DRM_BRIDGE_OP_HPD |
2686 DRM_BRIDGE_OP_DETECT;
2687 platform->bridge.type = platform->pdata.panel_bridge ?
2688 DRM_MODE_CONNECTOR_eDP :
2689 DRM_MODE_CONNECTOR_DisplayPort;
2690
2691 drm_bridge_add(&platform->bridge);
2692
2693 if (!platform->pdata.is_dpi) {
2694 ret = anx7625_attach_dsi(platform);
2695 if (ret) {
2696 DRM_DEV_ERROR(dev, "Fail to attach to dsi : %d\n", ret);
2697 goto unregister_bridge;
2698 }
2699 }
2700
2701 if (platform->pdata.audio_en)
2702 anx7625_register_audio(dev, platform);
2703
2704 DRM_DEV_DEBUG_DRIVER(dev, "probe done\n");
2705
2706 return 0;
2707
2708 unregister_bridge:
2709 drm_bridge_remove(&platform->bridge);
2710
2711 if (!platform->pdata.low_power_mode)
2712 pm_runtime_put_sync_suspend(&client->dev);
2713
2714 anx7625_unregister_i2c_dummy_clients(platform);
2715
2716 free_wq:
2717 if (platform->workqueue)
2718 destroy_workqueue(platform->workqueue);
2719
2720 free_hdcp_wq:
2721 if (platform->hdcp_workqueue)
2722 destroy_workqueue(platform->hdcp_workqueue);
2723
2724 return ret;
2725 }
2726
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
[android-common:upstream-f2fs-stable-linux-4.14.y 1255/1431] drivers/md/bitmap.c:382:32: warning: passing argument 2 of 'bmap' makes pointer from integer without a cast
by kernel test robot
Hi Carlos,
FYI, the error/warning still remains.
tree: https://android.googlesource.com/kernel/common upstream-f2fs-stable-linux-4.14.y
head: a1f8c5458f03b609b124191a55118e9c11109442
commit: ea4899e2410d1394cc4857298ecf8cc511d5afd4 [1255/1431] fs: Enable bmap() function to properly return errors
config: i386-randconfig-a003-20220117 (https://download.01.org/0day-ci/archive/20220120/202201201153.CiFuSOUM-lk...)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build):
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common upstream-f2fs-stable-linux-4.14.y
git checkout ea4899e2410d1394cc4857298ecf8cc511d5afd4
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/md/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/md/bitmap.c: In function 'read_page':
>> drivers/md/bitmap.c:382:32: warning: passing argument 2 of 'bmap' makes pointer from integer without a cast [-Wint-conversion]
bh->b_blocknr = bmap(inode, block);
^~~~~
In file included from include/linux/genhd.h:68:0,
from include/linux/blkdev.h:11,
from drivers/md/bitmap.c:18:
include/linux/fs.h:2729:12: note: expected 'sector_t * {aka long long unsigned int *}' but argument is of type 'sector_t {aka long long unsigned int}'
extern int bmap(struct inode *inode, sector_t *block);
^~~~
arch/x86/include/asm/bitops.h: Assembler messages:
arch/x86/include/asm/bitops.h:225: Warning: no instruction mnemonic suffix given and no register operands; using default for `bts'
arch/x86/include/asm/bitops.h:271: Warning: no instruction mnemonic suffix given and no register operands; using default for `btr'
vim +/bmap +382 drivers/md/bitmap.c
32a7627cf3a353 NeilBrown 2005-06-21 350
d785a06a0b9d0c NeilBrown 2006-06-26 351 /* read a page from a file.
d785a06a0b9d0c NeilBrown 2006-06-26 352 * We both read the page, and attach buffers to the page to record the
d785a06a0b9d0c NeilBrown 2006-06-26 353 * address of each block (using bmap). These addresses will be used
d785a06a0b9d0c NeilBrown 2006-06-26 354 * to write the block later, completely bypassing the filesystem.
d785a06a0b9d0c NeilBrown 2006-06-26 355 * This usage is similar to how swap files are handled, and allows us
d785a06a0b9d0c NeilBrown 2006-06-26 356 * to write to a file with no concerns of memory allocation failing.
d785a06a0b9d0c NeilBrown 2006-06-26 357 */
27581e5ae01f77 NeilBrown 2012-05-22 358 static int read_page(struct file *file, unsigned long index,
d785a06a0b9d0c NeilBrown 2006-06-26 359 struct bitmap *bitmap,
27581e5ae01f77 NeilBrown 2012-05-22 360 unsigned long count,
27581e5ae01f77 NeilBrown 2012-05-22 361 struct page *page)
32a7627cf3a353 NeilBrown 2005-06-21 362 {
27581e5ae01f77 NeilBrown 2012-05-22 363 int ret = 0;
496ad9aa8ef448 Al Viro 2013-01-23 364 struct inode *inode = file_inode(file);
d785a06a0b9d0c NeilBrown 2006-06-26 365 struct buffer_head *bh;
d785a06a0b9d0c NeilBrown 2006-06-26 366 sector_t block;
32a7627cf3a353 NeilBrown 2005-06-21 367
36a4e1fe0f4541 NeilBrown 2011-10-07 368 pr_debug("read bitmap file (%dB @ %llu)\n", (int)PAGE_SIZE,
2d1f3b5d1b2cd1 NeilBrown 2006-01-06 369 (unsigned long long)index << PAGE_SHIFT);
32a7627cf3a353 NeilBrown 2005-06-21 370
d785a06a0b9d0c NeilBrown 2006-06-26 371 bh = alloc_page_buffers(page, 1<<inode->i_blkbits, 0);
d785a06a0b9d0c NeilBrown 2006-06-26 372 if (!bh) {
27581e5ae01f77 NeilBrown 2012-05-22 373 ret = -ENOMEM;
d785a06a0b9d0c NeilBrown 2006-06-26 374 goto out;
d785a06a0b9d0c NeilBrown 2006-06-26 375 }
d785a06a0b9d0c NeilBrown 2006-06-26 376 attach_page_buffers(page, bh);
d785a06a0b9d0c NeilBrown 2006-06-26 377 block = index << (PAGE_SHIFT - inode->i_blkbits);
d785a06a0b9d0c NeilBrown 2006-06-26 378 while (bh) {
d785a06a0b9d0c NeilBrown 2006-06-26 379 if (count == 0)
d785a06a0b9d0c NeilBrown 2006-06-26 380 bh->b_blocknr = 0;
d785a06a0b9d0c NeilBrown 2006-06-26 381 else {
d785a06a0b9d0c NeilBrown 2006-06-26 @382 bh->b_blocknr = bmap(inode, block);
d785a06a0b9d0c NeilBrown 2006-06-26 383 if (bh->b_blocknr == 0) {
d785a06a0b9d0c NeilBrown 2006-06-26 384 /* Cannot use this file! */
27581e5ae01f77 NeilBrown 2012-05-22 385 ret = -EINVAL;
d785a06a0b9d0c NeilBrown 2006-06-26 386 goto out;
d785a06a0b9d0c NeilBrown 2006-06-26 387 }
d785a06a0b9d0c NeilBrown 2006-06-26 388 bh->b_bdev = inode->i_sb->s_bdev;
d785a06a0b9d0c NeilBrown 2006-06-26 389 if (count < (1<<inode->i_blkbits))
d785a06a0b9d0c NeilBrown 2006-06-26 390 count = 0;
32a7627cf3a353 NeilBrown 2005-06-21 391 else
d785a06a0b9d0c NeilBrown 2006-06-26 392 count -= (1<<inode->i_blkbits);
d785a06a0b9d0c NeilBrown 2006-06-26 393
d785a06a0b9d0c NeilBrown 2006-06-26 394 bh->b_end_io = end_bitmap_write;
d785a06a0b9d0c NeilBrown 2006-06-26 395 bh->b_private = bitmap;
ce25c31bdd3b39 NeilBrown 2006-06-26 396 atomic_inc(&bitmap->pending_writes);
ce25c31bdd3b39 NeilBrown 2006-06-26 397 set_buffer_locked(bh);
ce25c31bdd3b39 NeilBrown 2006-06-26 398 set_buffer_mapped(bh);
2a222ca992c35a Mike Christie 2016-06-05 399 submit_bh(REQ_OP_READ, 0, bh);
d785a06a0b9d0c NeilBrown 2006-06-26 400 }
d785a06a0b9d0c NeilBrown 2006-06-26 401 block++;
d785a06a0b9d0c NeilBrown 2006-06-26 402 bh = bh->b_this_page;
d785a06a0b9d0c NeilBrown 2006-06-26 403 }
d785a06a0b9d0c NeilBrown 2006-06-26 404 page->index = index;
ce25c31bdd3b39 NeilBrown 2006-06-26 405
ce25c31bdd3b39 NeilBrown 2006-06-26 406 wait_event(bitmap->write_wait,
ce25c31bdd3b39 NeilBrown 2006-06-26 407 atomic_read(&bitmap->pending_writes)==0);
b405fe91e50c60 NeilBrown 2012-05-22 408 if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags))
27581e5ae01f77 NeilBrown 2012-05-22 409 ret = -EIO;
32a7627cf3a353 NeilBrown 2005-06-21 410 out:
27581e5ae01f77 NeilBrown 2012-05-22 411 if (ret)
ec0cc226854a79 NeilBrown 2016-11-02 412 pr_err("md: bitmap read error: (%dB @ %llu): %d\n",
2d1f3b5d1b2cd1 NeilBrown 2006-01-06 413 (int)PAGE_SIZE,
2d1f3b5d1b2cd1 NeilBrown 2006-01-06 414 (unsigned long long)index << PAGE_SHIFT,
27581e5ae01f77 NeilBrown 2012-05-22 415 ret);
27581e5ae01f77 NeilBrown 2012-05-22 416 return ret;
32a7627cf3a353 NeilBrown 2005-06-21 417 }
32a7627cf3a353 NeilBrown 2005-06-21 418
:::::: The code at line 382 was first introduced by commit
:::::: d785a06a0b9d0cd86b3cc1bf8e236e62af7b47ed [PATCH] md/bitmap: change md/bitmap file handling to use bmap to file blocks
:::::: TO: NeilBrown <neilb(a)suse.de>
:::::: CC: Linus Torvalds <torvalds(a)g5.osdl.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months