Re: [PATCH 5/5] ACPI: scan: Fix race related to dropping dependencies

From: kernel test robot
Date: Wed Jun 16 2021 - 20:26:30 EST


Hi "Rafael,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on next-20210616]
[cannot apply to linux/master linus/master v5.13-rc6]
[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/Rafael-J-Wysocki/ACPI-scan-Fixes-and-cleanups-related-to-dependencies-list-handling/20210617-013528
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-b001-20210615 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/6369a007980e42b3ba7bbfb9833146f1867c790b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafael-J-Wysocki/ACPI-scan-Fixes-and-cleanups-related-to-dependencies-list-handling/20210617-013528
git checkout 6369a007980e42b3ba7bbfb9833146f1867c790b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/acpi/scan.c:660:5: warning: no previous prototype for function '__acpi_device_add' [-Wmissing-prototypes]
int __acpi_device_add(struct acpi_device *device,
^
drivers/acpi/scan.c:660:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int __acpi_device_add(struct acpi_device *device,
^
static
1 warning generated.


vim +/__acpi_device_add +660 drivers/acpi/scan.c

659
> 660 int __acpi_device_add(struct acpi_device *device,
661 void (*release)(struct device *))
662 {
663 struct acpi_device_bus_id *acpi_device_bus_id;
664 int result;
665
666 /*
667 * Linkage
668 * -------
669 * Link this device to its parent and siblings.
670 */
671 INIT_LIST_HEAD(&device->children);
672 INIT_LIST_HEAD(&device->node);
673 INIT_LIST_HEAD(&device->wakeup_list);
674 INIT_LIST_HEAD(&device->physical_node_list);
675 INIT_LIST_HEAD(&device->del_list);
676 mutex_init(&device->physical_node_lock);
677
678 mutex_lock(&acpi_device_lock);
679
680 acpi_device_bus_id = acpi_device_bus_id_match(acpi_device_hid(device));
681 if (acpi_device_bus_id) {
682 result = acpi_device_set_name(device, acpi_device_bus_id);
683 if (result)
684 goto err_unlock;
685 } else {
686 acpi_device_bus_id = kzalloc(sizeof(*acpi_device_bus_id),
687 GFP_KERNEL);
688 if (!acpi_device_bus_id) {
689 result = -ENOMEM;
690 goto err_unlock;
691 }
692 acpi_device_bus_id->bus_id =
693 kstrdup_const(acpi_device_hid(device), GFP_KERNEL);
694 if (!acpi_device_bus_id->bus_id) {
695 kfree(acpi_device_bus_id);
696 result = -ENOMEM;
697 goto err_unlock;
698 }
699
700 ida_init(&acpi_device_bus_id->instance_ida);
701
702 result = acpi_device_set_name(device, acpi_device_bus_id);
703 if (result) {
704 kfree_const(acpi_device_bus_id->bus_id);
705 kfree(acpi_device_bus_id);
706 goto err_unlock;
707 }
708
709 list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list);
710 }
711
712 if (device->parent)
713 list_add_tail(&device->node, &device->parent->children);
714
715 if (device->wakeup.flags.valid)
716 list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list);
717
718 mutex_unlock(&acpi_device_lock);
719
720 if (device->parent)
721 device->dev.parent = &device->parent->dev;
722
723 device->dev.bus = &acpi_bus_type;
724 device->dev.release = release;
725 result = device_add(&device->dev);
726 if (result) {
727 dev_err(&device->dev, "Error registering device\n");
728 goto err;
729 }
730
731 result = acpi_device_setup_files(device);
732 if (result)
733 pr_err("Error creating sysfs interface for device %s\n",
734 dev_name(&device->dev));
735
736 return 0;
737
738 err:
739 mutex_lock(&acpi_device_lock);
740
741 if (device->parent)
742 list_del(&device->node);
743
744 list_del(&device->wakeup_list);
745
746 err_unlock:
747 mutex_unlock(&acpi_device_lock);
748
749 acpi_detach_data(device->handle, acpi_scan_drop_device);
750
751 return result;
752 }
753

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip