Re: [PATCH] ACPI: ioremap: avoid redundant rounding to OS page size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ard,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on arm64/for-next/core arm/for-next soc/for-next v5.9-rc1 next-20200817]
[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/Ard-Biesheuvel/ACPI-ioremap-avoid-redundant-rounding-to-OS-page-size/20200817-200603
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-m021-20200817 (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@xxxxxxxxx>

smatch warnings:
drivers/acpi/osl.c:371 acpi_os_map_iomem() error: uninitialized symbol 'virt'.

# https://github.com/0day-ci/linux/commit/a34cc34917319aed90ebf9b0fbf4146666f5f75d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ard-Biesheuvel/ACPI-ioremap-avoid-redundant-rounding-to-OS-page-size/20200817-200603
git checkout a34cc34917319aed90ebf9b0fbf4146666f5f75d
vim +/virt +371 drivers/acpi/osl.c

   308	
   309	/**
   310	 * acpi_os_map_iomem - Get a virtual address for a given physical address range.
   311	 * @phys: Start of the physical address range to map.
   312	 * @size: Size of the physical address range to map.
   313	 *
   314	 * Look up the given physical address range in the list of existing ACPI memory
   315	 * mappings.  If found, get a reference to it and return a pointer to it (its
   316	 * virtual address).  If not found, map it, add it to that list and return a
   317	 * pointer to it.
   318	 *
   319	 * During early init (when acpi_permanent_mmap has not been set yet) this
   320	 * routine simply calls __acpi_map_table() to get the job done.
   321	 */
   322	void __iomem __ref
   323	*acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
   324	{
   325		struct acpi_ioremap *map;
   326		void __iomem *virt;
   327		acpi_physical_address pg_off;
   328		acpi_size pg_sz;
   329	
   330		if (phys > ULONG_MAX) {
   331			printk(KERN_ERR PREFIX "Cannot map memory that high\n");
   332			return NULL;
   333		}
   334	
   335		if (!acpi_permanent_mmap)
   336			return __acpi_map_table((unsigned long)phys, size);
   337	
   338		mutex_lock(&acpi_ioremap_lock);
   339		/* Check if there's a suitable mapping already. */
   340		map = acpi_map_lookup(phys, size);
   341		if (map) {
   342			map->track.refcount++;
   343			goto out;
   344		}
   345	
   346		map = kzalloc(sizeof(*map), GFP_KERNEL);
   347		if (!map) {
   348			mutex_unlock(&acpi_ioremap_lock);
   349			return NULL;
   350		}
   351	
   352		pg_off = round_down(phys, PAGE_SIZE);
   353		pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
   354		virt = acpi_map(phys, size);
   355		if (!virt) {
   356			mutex_unlock(&acpi_ioremap_lock);
   357			kfree(map);
   358			return NULL;
   359		}
   360	
   361		INIT_LIST_HEAD(&map->list);
   362		map->virt = (void *)((unsigned long)virt & PAGE_MASK);
   363		map->phys = pg_off;
   364		map->size = pg_sz;
   365		map->track.refcount = 1;
   366	
   367		list_add_tail_rcu(&map->list, &acpi_ioremaps);
   368	
   369	out:
   370		mutex_unlock(&acpi_ioremap_lock);
 > 371		return virt;
   372	}
   373	EXPORT_SYMBOL_GPL(acpi_os_map_iomem);
   374	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux