arch/powerpc/sysdev/xive/common.c:1161 xive_request_ipi() warn: unsigned 'xid->irq' is never less than zero.
From: kernel test robot
Date: Wed Jun 23 2021 - 02:45:14 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0c18f29aae7ce3dadd26d8ee3505d07cc982df75
commit: fd6db2892ebaa1383a93b4a609c65b96e615510a powerpc/xive: Modernize XIVE-IPI domain with an 'alloc' handler
date: 2 months ago
config: powerpc64-randconfig-m031-20210622 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
smatch warnings:
arch/powerpc/sysdev/xive/common.c:1161 xive_request_ipi() warn: unsigned 'xid->irq' is never less than zero.
vim +1161 arch/powerpc/sysdev/xive/common.c
1126
1127 static int __init xive_request_ipi(void)
1128 {
1129 struct fwnode_handle *fwnode;
1130 struct irq_domain *ipi_domain;
1131 unsigned int node;
1132 int ret = -ENOMEM;
1133
1134 fwnode = irq_domain_alloc_named_fwnode("XIVE-IPI");
1135 if (!fwnode)
1136 goto out;
1137
1138 ipi_domain = irq_domain_create_linear(fwnode, nr_node_ids,
1139 &xive_ipi_irq_domain_ops, NULL);
1140 if (!ipi_domain)
1141 goto out_free_fwnode;
1142
1143 xive_ipis = kcalloc(nr_node_ids, sizeof(*xive_ipis), GFP_KERNEL | __GFP_NOFAIL);
1144 if (!xive_ipis)
1145 goto out_free_domain;
1146
1147 for_each_node(node) {
1148 struct xive_ipi_desc *xid = &xive_ipis[node];
1149 struct xive_ipi_alloc_info info = { node };
1150
1151 /* Skip nodes without CPUs */
1152 if (cpumask_empty(cpumask_of_node(node)))
1153 continue;
1154
1155 /*
1156 * Map one IPI interrupt per node for all cpus of that node.
1157 * Since the HW interrupt number doesn't have any meaning,
1158 * simply use the node number.
1159 */
1160 xid->irq = irq_domain_alloc_irqs(ipi_domain, 1, node, &info);
> 1161 if (xid->irq < 0) {
1162 ret = xid->irq;
1163 goto out_free_xive_ipis;
1164 }
1165
1166 snprintf(xid->name, sizeof(xid->name), "IPI-%d", node);
1167
1168 ret = request_irq(xid->irq, xive_muxed_ipi_action,
1169 IRQF_PERCPU | IRQF_NO_THREAD, xid->name, NULL);
1170
1171 WARN(ret < 0, "Failed to request IPI %d: %d\n", xid->irq, ret);
1172 }
1173
1174 return ret;
1175
1176 out_free_xive_ipis:
1177 kfree(xive_ipis);
1178 out_free_domain:
1179 irq_domain_remove(ipi_domain);
1180 out_free_fwnode:
1181 irq_domain_free_fwnode(fwnode);
1182 out:
1183 return ret;
1184 }
1185
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip