lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202202211603.3Q45j1R6-lkp@intel.com>
Date:   Mon, 21 Feb 2022 16:29:44 +0800
From:   kernel test robot <lkp@...el.com>
To:     Henning Schild <henning.schild@...mens.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Hans de Goede <hdegoede@...hat.com>
Subject: drivers/leds/simple/simatic-ipc-leds.c:42:17: sparse: sparse: symbol
 'simatic_ipc_led_mem_res' was not declared. Should it be static?

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cfb92440ee71adcc2105b0890bb01ac3cddb8507
commit: 8c78e0614edc628b13313afd28856720b85d86a3 leds: simatic-ipc-leds: add new driver for Siemens Industial PCs
date:   9 weeks ago
config: x86_64-randconfig-s022-20220221 (https://download.01.org/0day-ci/archive/20220221/202202211603.3Q45j1R6-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8c78e0614edc628b13313afd28856720b85d86a3
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8c78e0614edc628b13313afd28856720b85d86a3
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/leds/simple/

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


sparse warnings: (new ones prefixed by >>)
>> drivers/leds/simple/simatic-ipc-leds.c:42:17: sparse: sparse: symbol 'simatic_ipc_led_mem_res' was not declared. Should it be static?
>> drivers/leds/simple/simatic-ipc-leds.c:155:40: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *static [toplevel] simatic_ipc_led_memory @@     got void [noderef] __iomem * @@
   drivers/leds/simple/simatic-ipc-leds.c:155:40: sparse:     expected void *static [toplevel] simatic_ipc_led_memory
   drivers/leds/simple/simatic-ipc-leds.c:155:40: sparse:     got void [noderef] __iomem *

vim +/simatic_ipc_led_mem_res +42 drivers/leds/simple/simatic-ipc-leds.c

    40	
    41	/* the actual start will be discovered with PCI, 0 is a placeholder */
  > 42	struct resource simatic_ipc_led_mem_res = DEFINE_RES_MEM_NAMED(0, SZ_4K, KBUILD_MODNAME);
    43	
    44	static void *simatic_ipc_led_memory;
    45	
    46	static struct simatic_ipc_led simatic_ipc_leds_mem[] = {
    47		{0x500 + 0x1A0, "red:" LED_FUNCTION_STATUS "-1"},
    48		{0x500 + 0x1A8, "green:" LED_FUNCTION_STATUS "-1"},
    49		{0x500 + 0x1C8, "red:" LED_FUNCTION_STATUS "-2"},
    50		{0x500 + 0x1D0, "green:" LED_FUNCTION_STATUS "-2"},
    51		{0x500 + 0x1E0, "red:" LED_FUNCTION_STATUS "-3"},
    52		{0x500 + 0x198, "green:" LED_FUNCTION_STATUS "-3"},
    53		{ }
    54	};
    55	
    56	static struct resource simatic_ipc_led_io_res =
    57		DEFINE_RES_IO_NAMED(SIMATIC_IPC_LED_PORT_BASE, SZ_2, KBUILD_MODNAME);
    58	
    59	static DEFINE_SPINLOCK(reg_lock);
    60	
    61	static inline struct simatic_ipc_led *cdev_to_led(struct led_classdev *led_cd)
    62	{
    63		return container_of(led_cd, struct simatic_ipc_led, cdev);
    64	}
    65	
    66	static void simatic_ipc_led_set_io(struct led_classdev *led_cd,
    67					   enum led_brightness brightness)
    68	{
    69		struct simatic_ipc_led *led = cdev_to_led(led_cd);
    70		unsigned long flags;
    71		unsigned int val;
    72	
    73		spin_lock_irqsave(&reg_lock, flags);
    74	
    75		val = inw(SIMATIC_IPC_LED_PORT_BASE);
    76		if (brightness == LED_OFF)
    77			outw(val | led->value, SIMATIC_IPC_LED_PORT_BASE);
    78		else
    79			outw(val & ~led->value, SIMATIC_IPC_LED_PORT_BASE);
    80	
    81		spin_unlock_irqrestore(&reg_lock, flags);
    82	}
    83	
    84	static enum led_brightness simatic_ipc_led_get_io(struct led_classdev *led_cd)
    85	{
    86		struct simatic_ipc_led *led = cdev_to_led(led_cd);
    87	
    88		return inw(SIMATIC_IPC_LED_PORT_BASE) & led->value ? LED_OFF : led_cd->max_brightness;
    89	}
    90	
    91	static void simatic_ipc_led_set_mem(struct led_classdev *led_cd,
    92					    enum led_brightness brightness)
    93	{
    94		struct simatic_ipc_led *led = cdev_to_led(led_cd);
    95	
    96		u32 *p;
    97	
    98		p = simatic_ipc_led_memory + led->value;
    99		*p = (*p & ~1) | (brightness == LED_OFF);
   100	}
   101	
   102	static enum led_brightness simatic_ipc_led_get_mem(struct led_classdev *led_cd)
   103	{
   104		struct simatic_ipc_led *led = cdev_to_led(led_cd);
   105	
   106		u32 *p;
   107	
   108		p = simatic_ipc_led_memory + led->value;
   109		return (*p & 1) ? LED_OFF : led_cd->max_brightness;
   110	}
   111	
   112	static int simatic_ipc_leds_probe(struct platform_device *pdev)
   113	{
   114		const struct simatic_ipc_platform *plat = pdev->dev.platform_data;
   115		struct device *dev = &pdev->dev;
   116		struct simatic_ipc_led *ipcled;
   117		struct led_classdev *cdev;
   118		struct resource *res;
   119		int err, type;
   120		u32 *p;
   121	
   122		switch (plat->devmode) {
   123		case SIMATIC_IPC_DEVICE_227D:
   124		case SIMATIC_IPC_DEVICE_427E:
   125			res = &simatic_ipc_led_io_res;
   126			ipcled = simatic_ipc_leds_io;
   127			/* on 227D the two bytes work the other way araound */
   128			if (plat->devmode == SIMATIC_IPC_DEVICE_227D) {
   129				while (ipcled->value) {
   130					ipcled->value = swab16(ipcled->value);
   131					ipcled++;
   132				}
   133				ipcled = simatic_ipc_leds_io;
   134			}
   135			type = IORESOURCE_IO;
   136			if (!devm_request_region(dev, res->start, resource_size(res), KBUILD_MODNAME)) {
   137				dev_err(dev, "Unable to register IO resource at %pR\n", res);
   138				return -EBUSY;
   139			}
   140			break;
   141		case SIMATIC_IPC_DEVICE_127E:
   142			res = &simatic_ipc_led_mem_res;
   143			ipcled = simatic_ipc_leds_mem;
   144			type = IORESOURCE_MEM;
   145	
   146			/* get GPIO base from PCI */
   147			res->start = simatic_ipc_get_membase0(PCI_DEVFN(13, 0));
   148			if (res->start == 0)
   149				return -ENODEV;
   150	
   151			/* do the final address calculation */
   152			res->start = res->start + (0xC5 << 16);
   153			res->end += res->start;
   154	
 > 155			simatic_ipc_led_memory = devm_ioremap_resource(dev, res);
   156			if (IS_ERR(simatic_ipc_led_memory))
   157				return PTR_ERR(simatic_ipc_led_memory);
   158	
   159			/* initialize power/watchdog LED */
   160			p = simatic_ipc_led_memory + 0x500 + 0x1D8; /* PM_WDT_OUT */
   161			*p = (*p & ~1);
   162			p = simatic_ipc_led_memory + 0x500 + 0x1C0; /* PM_BIOS_BOOT_N */
   163			*p = (*p | 1);
   164	
   165			break;
   166		default:
   167			return -ENODEV;
   168		}
   169	
   170		while (ipcled->value) {
   171			cdev = &ipcled->cdev;
   172			if (type == IORESOURCE_MEM) {
   173				cdev->brightness_set = simatic_ipc_led_set_mem;
   174				cdev->brightness_get = simatic_ipc_led_get_mem;
   175			} else {
   176				cdev->brightness_set = simatic_ipc_led_set_io;
   177				cdev->brightness_get = simatic_ipc_led_get_io;
   178			}
   179			cdev->max_brightness = LED_ON;
   180			cdev->name = ipcled->name;
   181	
   182			err = devm_led_classdev_register(dev, cdev);
   183			if (err < 0)
   184				return err;
   185			ipcled++;
   186		}
   187	
   188		return 0;
   189	}
   190	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ