tree:
https://github.com/intel/linux-intel-lts.git 5.4/yocto
head: bda68cfc97bb728fbb144928c2269de95e433a76
commit: a83e0909a8eb378a3a62a3c14d2a555784216cec [2/3] tcc: this is kernel driver to
interface to TCC PTCM pesudo SRAM
config: i386-randconfig-m021-20201211 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.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:
drivers/tcc/tcc_buffer.c:629 tcc_buffer_init() warn: returning -1 instead of -ENOMEM is
sloppy
Old smatch warnings:
drivers/tcc/tcc_buffer.c:289 tcc_parse_ptct() warn: returning -1 instead of -ENOMEM is
sloppy
drivers/tcc/tcc_buffer.c:312 tcc_parse_ptct() warn: returning -1 instead of -ENOMEM is
sloppy
vim +629 drivers/tcc/tcc_buffer.c
a83e0909a8eb37 Qiang Rao 2020-05-26 614 static int __init tcc_buffer_init(void)
a83e0909a8eb37 Qiang Rao 2020-05-26 615 {
a83e0909a8eb37 Qiang Rao 2020-05-26 616 int ret;
a83e0909a8eb37 Qiang Rao 2020-05-26 617 struct device *dev_ret;
a83e0909a8eb37 Qiang Rao 2020-05-26 618 u32 new_minor = UNDEFINED_DEVNODE;
a83e0909a8eb37 Qiang Rao 2020-05-26 619 acpi_status status = AE_OK;
a83e0909a8eb37 Qiang Rao 2020-05-26 620
a83e0909a8eb37 Qiang Rao 2020-05-26 621 status = acpi_get_table(ACPI_SIG_PTCT, 0,
&acpi_ptct_tbl);
a83e0909a8eb37 Qiang Rao 2020-05-26 622 if (ACPI_FAILURE(status) || !acpi_ptct_tbl) {
a83e0909a8eb37 Qiang Rao 2020-05-26 623 pr_err("Stop! ACPI doesn't provide
PTCT.");
a83e0909a8eb37 Qiang Rao 2020-05-26 624 return -1;
a83e0909a8eb37 Qiang Rao 2020-05-26 625 }
a83e0909a8eb37 Qiang Rao 2020-05-26 626
a83e0909a8eb37 Qiang Rao 2020-05-26 627 p_tcc_config = kzalloc(sizeof(struct
tcc_config), GFP_KERNEL);
a83e0909a8eb37 Qiang Rao 2020-05-26 628 if (!p_tcc_config)
a83e0909a8eb37 Qiang Rao 2020-05-26 @629 return -1;
^^^^^^^^^
return -ENOMEM;
a83e0909a8eb37 Qiang Rao 2020-05-26 630 INIT_LIST_HEAD(&p_tcc_config->psrams);
a83e0909a8eb37 Qiang Rao 2020-05-26 631
a83e0909a8eb37 Qiang Rao 2020-05-26 632 ret = tcc_parse_ptct();
a83e0909a8eb37 Qiang Rao 2020-05-26 633 if (ret != 0)
a83e0909a8eb37 Qiang Rao 2020-05-26 634 goto err_exit;
a83e0909a8eb37 Qiang Rao 2020-05-26 635
a83e0909a8eb37 Qiang Rao 2020-05-26 636 ret = register_chrdev(0, TCC_BUFFER_NAME,
&tcc_buffer_fops);
a83e0909a8eb37 Qiang Rao 2020-05-26 637 if (ret < 0) {
a83e0909a8eb37 Qiang Rao 2020-05-26 638 pr_err("Couldn't regiter_chrdev,
returen error=%d\n", ret);
a83e0909a8eb37 Qiang Rao 2020-05-26 639 goto err_exit;
a83e0909a8eb37 Qiang Rao 2020-05-26 640 }
a83e0909a8eb37 Qiang Rao 2020-05-26 641 tcc_buffer_device_major = ret;
a83e0909a8eb37 Qiang Rao 2020-05-26 642
a83e0909a8eb37 Qiang Rao 2020-05-26 643 ret = tcc_buffer_minor_get(&new_minor);
a83e0909a8eb37 Qiang Rao 2020-05-26 644 if (ret < 0) {
a83e0909a8eb37 Qiang Rao 2020-05-26 645 pr_err("Unable to obtain a new minor
number\n");
a83e0909a8eb37 Qiang Rao 2020-05-26 646 goto err_class;
a83e0909a8eb37 Qiang Rao 2020-05-26 647 }
a83e0909a8eb37 Qiang Rao 2020-05-26 648
a83e0909a8eb37 Qiang Rao 2020-05-26 649 tcc_buffer_class = class_create(THIS_MODULE,
TCC_BUFFER_NAME);
a83e0909a8eb37 Qiang Rao 2020-05-26 650 if (IS_ERR(tcc_buffer_class)) {
a83e0909a8eb37 Qiang Rao 2020-05-26 651 ret = PTR_ERR(tcc_buffer_class);
a83e0909a8eb37 Qiang Rao 2020-05-26 652 pr_err("Create class failed!\n");
a83e0909a8eb37 Qiang Rao 2020-05-26 653 goto err_class;
a83e0909a8eb37 Qiang Rao 2020-05-26 654 }
a83e0909a8eb37 Qiang Rao 2020-05-26 655
a83e0909a8eb37 Qiang Rao 2020-05-26 656 dev_ret = device_create(tcc_buffer_class,
NULL,
a83e0909a8eb37 Qiang Rao 2020-05-26 657 MKDEV(tcc_buffer_device_major, new_minor),
NULL,
a83e0909a8eb37 Qiang Rao 2020-05-26 658 TCC_BUFFER_NAME);
a83e0909a8eb37 Qiang Rao 2020-05-26 659
a83e0909a8eb37 Qiang Rao 2020-05-26 660 if (IS_ERR(dev_ret)) {
a83e0909a8eb37 Qiang Rao 2020-05-26 661 ret = PTR_ERR(dev_ret);
a83e0909a8eb37 Qiang Rao 2020-05-26 662 pr_err("Failed to create character
device\n");
a83e0909a8eb37 Qiang Rao 2020-05-26 663 goto err_device;
a83e0909a8eb37 Qiang Rao 2020-05-26 664 }
a83e0909a8eb37 Qiang Rao 2020-05-26 665 tcc_init = 1;
a83e0909a8eb37 Qiang Rao 2020-05-26 666 p_tcc_config->minor = new_minor;
a83e0909a8eb37 Qiang Rao 2020-05-26 667
a83e0909a8eb37 Qiang Rao 2020-05-26 668 pr_err("TCC buffer init
successfully\n");
a83e0909a8eb37 Qiang Rao 2020-05-26 669 return 0;
a83e0909a8eb37 Qiang Rao 2020-05-26 670
a83e0909a8eb37 Qiang Rao 2020-05-26 671 err_device:
a83e0909a8eb37 Qiang Rao 2020-05-26 672 class_destroy(tcc_buffer_class);
a83e0909a8eb37 Qiang Rao 2020-05-26 673 err_class:
a83e0909a8eb37 Qiang Rao 2020-05-26 674 unregister_chrdev(tcc_buffer_device_major,
TCC_BUFFER_NAME);
a83e0909a8eb37 Qiang Rao 2020-05-26 675 err_exit:
a83e0909a8eb37 Qiang Rao 2020-05-26 676 tcc_cleanup();
a83e0909a8eb37 Qiang Rao 2020-05-26 677 kfree(p_tcc_config);
a83e0909a8eb37 Qiang Rao 2020-05-26 678 return ret;
a83e0909a8eb37 Qiang Rao 2020-05-26 679 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org