[PATCH -next] irqchip/riscv-aplic: Fix NULL vs IS_ERR() bug
kernel test robot
lkp at intel.com
Thu Aug 22 14:36:20 PDT 2024
Hi Yue,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20240820]
url: https://github.com/intel-lab-lkp/linux/commits/Yue-Haibing/irqchip-riscv-aplic-Fix-NULL-vs-IS_ERR-bug/20240820-213521
base: next-20240820
patch link: https://lore.kernel.org/r/20240820132857.247679-1-yuehaibing%40huawei.com
patch subject: [PATCH -next] irqchip/riscv-aplic: Fix NULL vs IS_ERR() bug
config: riscv-allnoconfig (https://download.01.org/0day-ci/archive/20240823/202408230558.er4j09Nd-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240823/202408230558.er4j09Nd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408230558.er4j09Nd-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/irqchip/irq-riscv-aplic-main.c: In function 'aplic_probe':
>> drivers/irqchip/irq-riscv-aplic-main.c:178:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
178 | if (IS_ERR(regs))
| ^~
drivers/irqchip/irq-riscv-aplic-main.c:180:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
180 | return PTR_ERR(regs);
| ^~~~~~
>> drivers/irqchip/irq-riscv-aplic-main.c:174:13: warning: unused variable 'rc' [-Wunused-variable]
174 | int rc;
| ^~
>> drivers/irqchip/irq-riscv-aplic-main.c:172:14: warning: unused variable 'msi_mode' [-Wunused-variable]
172 | bool msi_mode = false;
| ^~~~~~~~
drivers/irqchip/irq-riscv-aplic-main.c: At top level:
>> drivers/irqchip/irq-riscv-aplic-main.c:187:9: warning: data definition has no type or storage class
187 | msi_mode = of_property_present(to_of_node(dev->fwnode), "msi-parent");
| ^~~~~~~~
>> drivers/irqchip/irq-riscv-aplic-main.c:187:9: error: type defaults to 'int' in declaration of 'msi_mode' [-Wimplicit-int]
In file included from drivers/irqchip/irq-riscv-aplic-main.c:10:
>> include/linux/of.h:168:9: error: braced-group within expression allowed only inside a function
168 | ({ \
| ^
drivers/irqchip/irq-riscv-aplic-main.c:187:40: note: in expansion of macro 'to_of_node'
187 | msi_mode = of_property_present(to_of_node(dev->fwnode), "msi-parent");
| ^~~~~~~~~~
>> drivers/irqchip/irq-riscv-aplic-main.c:188:9: error: expected identifier or '(' before 'if'
188 | if (msi_mode)
| ^~
>> drivers/irqchip/irq-riscv-aplic-main.c:190:9: error: expected identifier or '(' before 'else'
190 | else
| ^~~~
drivers/irqchip/irq-riscv-aplic-main.c:192:9: error: expected identifier or '(' before 'if'
192 | if (rc)
| ^~
In file included from include/linux/device.h:15,
from include/linux/platform_device.h:13,
from drivers/irqchip/irq-riscv-aplic-main.c:12:
>> include/linux/dev_printk.h:111:10: error: expected identifier or '(' before ')' token
111 | })
| ^
include/linux/dev_printk.h:154:9: note: in expansion of macro 'dev_printk_index_wrap'
154 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-aplic-main.c:193:17: note: in expansion of macro 'dev_err'
193 | dev_err(dev, "failed to setup APLIC in %s mode\n", msi_mode ? "MSI" : "direct");
| ^~~~~~~
>> drivers/irqchip/irq-riscv-aplic-main.c:195:9: error: expected identifier or '(' before 'return'
195 | return rc;
| ^~~~~~
>> drivers/irqchip/irq-riscv-aplic-main.c:196:1: error: expected identifier or '(' before '}' token
196 | }
| ^
vim +187 drivers/irqchip/irq-riscv-aplic-main.c
2333df5ae51ead Anup Patel 2024-03-07 168
2333df5ae51ead Anup Patel 2024-03-07 169 static int aplic_probe(struct platform_device *pdev)
2333df5ae51ead Anup Patel 2024-03-07 170 {
2333df5ae51ead Anup Patel 2024-03-07 171 struct device *dev = &pdev->dev;
2333df5ae51ead Anup Patel 2024-03-07 @172 bool msi_mode = false;
2333df5ae51ead Anup Patel 2024-03-07 173 void __iomem *regs;
2333df5ae51ead Anup Patel 2024-03-07 @174 int rc;
2333df5ae51ead Anup Patel 2024-03-07 175
2333df5ae51ead Anup Patel 2024-03-07 176 /* Map the MMIO registers */
2333df5ae51ead Anup Patel 2024-03-07 177 regs = devm_platform_ioremap_resource(pdev, 0);
bb109b384dab1e Yue Haibing 2024-08-20 @178 if (IS_ERR(regs))
2333df5ae51ead Anup Patel 2024-03-07 179 dev_err(dev, "failed map MMIO registers\n");
bb109b384dab1e Yue Haibing 2024-08-20 180 return PTR_ERR(regs);
2333df5ae51ead Anup Patel 2024-03-07 181 }
2333df5ae51ead Anup Patel 2024-03-07 182
2333df5ae51ead Anup Patel 2024-03-07 183 /*
2333df5ae51ead Anup Patel 2024-03-07 184 * If msi-parent property is present then setup APLIC MSI
2333df5ae51ead Anup Patel 2024-03-07 185 * mode otherwise setup APLIC direct mode.
2333df5ae51ead Anup Patel 2024-03-07 186 */
2333df5ae51ead Anup Patel 2024-03-07 @187 msi_mode = of_property_present(to_of_node(dev->fwnode), "msi-parent");
2333df5ae51ead Anup Patel 2024-03-07 @188 if (msi_mode)
ca8df97fe6798a Anup Patel 2024-03-07 189 rc = aplic_msi_setup(dev, regs);
2333df5ae51ead Anup Patel 2024-03-07 @190 else
2333df5ae51ead Anup Patel 2024-03-07 191 rc = aplic_direct_setup(dev, regs);
2333df5ae51ead Anup Patel 2024-03-07 192 if (rc)
2333df5ae51ead Anup Patel 2024-03-07 193 dev_err(dev, "failed to setup APLIC in %s mode\n", msi_mode ? "MSI" : "direct");
2333df5ae51ead Anup Patel 2024-03-07 194
2333df5ae51ead Anup Patel 2024-03-07 @195 return rc;
2333df5ae51ead Anup Patel 2024-03-07 @196 }
2333df5ae51ead Anup Patel 2024-03-07 197
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the linux-riscv
mailing list