tree:
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git acpica-osl
head: cfc2a23e4be42e58a453502acaf4a6330ef32f5f
commit: cfc2a23e4be42e58a453502acaf4a6330ef32f5f [2/2] ACPI: OSL: Add support for deferred
unmapping of ACPI memory
config: i386-randconfig-s031-20200614 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-250-g42323db3-dirty
git checkout cfc2a23e4be42e58a453502acaf4a6330ef32f5f
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
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 >>, old ones prefixed by <<):
drivers/acpi/osl.c: In function 'acpi_os_vprintf':
drivers/acpi/osl.c:153:2: warning: function 'acpi_os_vprintf' might be a candidate
for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
153 | vsprintf(buffer, fmt, args);
| ^~~~~~~~
drivers/acpi/osl.c: In function 'acpi_os_unmap_generic_address':
> drivers/acpi/osl.c:533:13: error: implicit declaration of
function 'acpi_os_drop_map_ref' [-Werror=implicit-function-declaration]
533
| refcount = acpi_os_drop_map_ref(map);
| ^~~~~~~~~~~~~~~~~~~~
> drivers/acpi/osl.c:537:3: error: implicit declaration of function
'acpi_os_map_cleanup'; did you mean 'acpi_os_map_memory'?
[-Werror=implicit-function-declaration]
537 | acpi_os_map_cleanup(map);
| ^~~~~~~~~~~~~~~~~~~
| acpi_os_map_memory
cc1: some warnings being treated as errors
sparse warnings: (new ones prefixed by >>)
drivers/acpi/osl.c:375:17: sparse: sparse: cast removes address space
'<asn:2>' of expression
> drivers/acpi/osl.c:481:29: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void [noderef] <asn:2> *virt
@@ got void *virt @@
> drivers/acpi/osl.c:481:29: sparse: expected void [noderef] <asn:2> *virt
> drivers/acpi/osl.c:481:29: sparse: got void *virt
drivers/acpi/osl.c:533:20: sparse: sparse: undefined identifier
'acpi_os_drop_map_ref'
drivers/acpi/osl.c:537:17: sparse: sparse: undefined identifier
'acpi_os_map_cleanup'
drivers/acpi/osl.c:757:1: sparse: sparse: context imbalance in
'acpi_os_read_memory' - wrong count at exit
drivers/acpi/osl.c:790:1: sparse: sparse: context imbalance in
'acpi_os_write_memory' - wrong count at exit
vim +/acpi_os_drop_map_ref +533 drivers/acpi/osl.c
620242ae8c3d9c Myron Stowe 2010-10-21 466
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 467 /**
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 468 * acpi_os_unmap_deferred - Drop a
memory mapping reference.
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 469 * @virt: Start of the address range
to drop a reference to.
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 470 * @size: Size of the address range to
drop a reference to.
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 471 *
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 472 * Look up the given virtual address
range in the list of existing ACPI memory
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 473 * mappings, drop a reference to it
and if there are no more active references
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 474 * to it, put it in the list of unused
memory mappings.
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 475 *
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 476 * During early init (when
acpi_permanent_mmap has not been set yet) this
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 477 * routine behaves like
acpi_os_unmap_memory().
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 478 */
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 479 void __ref acpi_os_unmap_deferred(void
*virt, acpi_size size)
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 480 {
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 @481 acpi_os_unref_iomem(virt, size);
ad71860a17ba33 Alexey Starikovskiy 2007-02-02 482 }
a238317ce81855 Lv Zheng 2014-05-20 483
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 484 /**
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 485 * acpi_os_release_unused_mappings -
Release unused ACPI memory mappings.
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 486 */
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 487 void
acpi_os_release_unused_mappings(void)
a238317ce81855 Lv Zheng 2014-05-20 488 {
cfc2a23e4be42e Rafael J. Wysocki 2020-06-13 489
__acpi_os_release_unused_mappings(false);
a238317ce81855 Lv Zheng 2014-05-20 490 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 491
6f68c91c55ea35 Myron Stowe 2011-11-07 492 int acpi_os_map_generic_address(struct
acpi_generic_address *gas)
29718521237a1b Myron Stowe 2010-10-21 493 {
bc9ffce27962c0 Myron Stowe 2011-11-07 494 u64 addr;
29718521237a1b Myron Stowe 2010-10-21 495 void __iomem *virt;
29718521237a1b Myron Stowe 2010-10-21 496
bc9ffce27962c0 Myron Stowe 2011-11-07 497 if (gas->space_id !=
ACPI_ADR_SPACE_SYSTEM_MEMORY)
29718521237a1b Myron Stowe 2010-10-21 498 return 0;
29718521237a1b Myron Stowe 2010-10-21 499
bc9ffce27962c0 Myron Stowe 2011-11-07 500 /* Handle possible alignment issues
*/
bc9ffce27962c0 Myron Stowe 2011-11-07 501 memcpy(&addr,
&gas->address, sizeof(addr));
bc9ffce27962c0 Myron Stowe 2011-11-07 502 if (!addr || !gas->bit_width)
29718521237a1b Myron Stowe 2010-10-21 503 return -EINVAL;
29718521237a1b Myron Stowe 2010-10-21 504
a238317ce81855 Lv Zheng 2014-05-20 505 virt = acpi_os_map_iomem(addr,
gas->bit_width / 8);
29718521237a1b Myron Stowe 2010-10-21 506 if (!virt)
29718521237a1b Myron Stowe 2010-10-21 507 return -EIO;
29718521237a1b Myron Stowe 2010-10-21 508
29718521237a1b Myron Stowe 2010-10-21 509 return 0;
29718521237a1b Myron Stowe 2010-10-21 510 }
6f68c91c55ea35 Myron Stowe 2011-11-07 511
EXPORT_SYMBOL(acpi_os_map_generic_address);
29718521237a1b Myron Stowe 2010-10-21 512
6f68c91c55ea35 Myron Stowe 2011-11-07 513 void
acpi_os_unmap_generic_address(struct acpi_generic_address *gas)
29718521237a1b Myron Stowe 2010-10-21 514 {
bc9ffce27962c0 Myron Stowe 2011-11-07 515 u64 addr;
7fe135dc058fae Rafael J. Wysocki 2011-02-08 516 struct acpi_ioremap *map;
833a426cc471b6 Francesco Ruggeri 2019-11-19 517 unsigned long refcount;
29718521237a1b Myron Stowe 2010-10-21 518
bc9ffce27962c0 Myron Stowe 2011-11-07 519 if (gas->space_id !=
ACPI_ADR_SPACE_SYSTEM_MEMORY)
29718521237a1b Myron Stowe 2010-10-21 520 return;
29718521237a1b Myron Stowe 2010-10-21 521
bc9ffce27962c0 Myron Stowe 2011-11-07 522 /* Handle possible alignment issues
*/
bc9ffce27962c0 Myron Stowe 2011-11-07 523 memcpy(&addr,
&gas->address, sizeof(addr));
bc9ffce27962c0 Myron Stowe 2011-11-07 524 if (!addr || !gas->bit_width)
29718521237a1b Myron Stowe 2010-10-21 525 return;
29718521237a1b Myron Stowe 2010-10-21 526
7bbb890358b96c Rafael J. Wysocki 2011-02-08 527 mutex_lock(&acpi_ioremap_lock);
bc9ffce27962c0 Myron Stowe 2011-11-07 528 map = acpi_map_lookup(addr,
gas->bit_width / 8);
7fe135dc058fae Rafael J. Wysocki 2011-02-08 529 if (!map) {
7fe135dc058fae Rafael J. Wysocki 2011-02-08 530
mutex_unlock(&acpi_ioremap_lock);
7fe135dc058fae Rafael J. Wysocki 2011-02-08 531 return;
7fe135dc058fae Rafael J. Wysocki 2011-02-08 532 }
833a426cc471b6 Francesco Ruggeri 2019-11-19 @533 refcount =
acpi_os_drop_map_ref(map);
7bbb890358b96c Rafael J. Wysocki 2011-02-08 534
mutex_unlock(&acpi_ioremap_lock);
29718521237a1b Myron Stowe 2010-10-21 535
833a426cc471b6 Francesco Ruggeri 2019-11-19 536 if (!refcount)
b7c1fadd6c2eea Rafael J. Wysocki 2011-02-08 @537 acpi_os_map_cleanup(map);
29718521237a1b Myron Stowe 2010-10-21 538 }
6f68c91c55ea35 Myron Stowe 2011-11-07 539
EXPORT_SYMBOL(acpi_os_unmap_generic_address);
29718521237a1b Myron Stowe 2010-10-21 540
:::::: The code at line 533 was first introduced by commit
:::::: 833a426cc471b6088011b3d67f1dc4e147614647 ACPI: OSL: only free map once in osl.c
:::::: TO: Francesco Ruggeri <fruggeri(a)arista.com>
:::::: CC: Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org