[brgl:gpio/for-next 63/65] drivers/gpio/gpio-loongson-64bit.c:250:59: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot <hidden>
Date: 2022-12-06 01:17:48
Also in: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
head:   96010045bb9eb70dcb67937e4e6ac182bdb2b1be
commit: d9cfe5825bb342548a5abd57ad37c7523b9ef446 [63/65] gpio: loongson: add gpio driver support
config: powerpc-randconfig-s033-20221206
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git/commit/?id=d9cfe5825bb342548a5abd57ad37c7523b9ef446
        git remote add brgl https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
        git fetch --no-tags brgl gpio/for-next
        git checkout d9cfe5825bb342548a5abd57ad37c7523b9ef446
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot [off-list ref]

sparse warnings: (new ones prefixed by >>)
quoted
drivers/gpio/gpio-loongson-64bit.c:250:59: sparse: sparse: Using plain integer as NULL pointer
vim +250 drivers/gpio/gpio-loongson-64bit.c

   234	
   235	static int loongson_gpio_init(
   236				struct device *dev, struct loongson_gpio_chip *lgpio,
   237				struct device_node *np, void __iomem *reg_base)
   238	{
   239		int ret;
   240		u32 ngpios;
   241		struct irq_domain *parent;
   242		struct gpio_irq_chip *girq;
   243		struct device_node *irq_parent;
   244	
   245		lgpio->reg_base = reg_base;
   246	
   247		if (lgpio->chip_data->mode == BIT_CTRL_MODE) {
   248			ret = bgpio_init(&lgpio->chip, dev, 8,
   249					LOONGSON_GPIO_IN(lgpio),
 > 250					LOONGSON_GPIO_OUT(lgpio), 0,
   251					LOONGSON_GPIO_OEN(lgpio), NULL, 0);
   252			if (ret) {
   253				dev_err(dev, "unable to init generic GPIO\n");
   254				return ret;
   255			}
   256		} else {
   257			lgpio->chip.direction_input = loongson_gpio_direction_input;
   258			lgpio->chip.get = loongson_gpio_get;
   259			lgpio->chip.get_direction = loongson_gpio_get_direction;
   260			lgpio->chip.direction_output = loongson_gpio_direction_output;
   261			lgpio->chip.set = loongson_gpio_set;
   262			lgpio->chip.can_sleep = 0;
   263			lgpio->chip.of_node = np;
   264			lgpio->chip.parent = dev;
   265			spin_lock_init(&lgpio->lock);
   266		}
   267	
   268		device_property_read_u32(dev, "ngpios", &ngpios);
   269	
   270		lgpio->chip.ngpio = ngpios;
   271		lgpio->chip.label = lgpio->chip_data->label;
   272	
   273		if (lgpio->chip_data->support_irq == true) {
   274			lgpio->chip.to_irq = loongson_gpio_to_irq;
   275			irq_parent = of_irq_find_parent(np);
   276			if (irq_parent)
   277				parent = irq_find_host(irq_parent);
   278	
   279			lgpio->fwnode = of_node_to_fwnode(np);
   280	
   281			girq = &lgpio->chip.irq;
   282			gpio_irq_chip_set_chip(girq, &loongson_gpio_irqchip);
   283			girq->fwnode = lgpio->fwnode;
   284			girq->parent_domain = parent;
   285			girq->child_to_parent_hwirq = loongson_gpio_child_to_parent_hwirq;
   286			girq->handler = handle_bad_irq;
   287			girq->default_type = IRQ_TYPE_NONE;
   288		}
   289	
   290		return devm_gpiochip_add_data(dev, &lgpio->chip, lgpio);
   291	}
   292	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help