Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/xive: Fix error handling when allocating an IPI

This is a smatch warning:

arch/powerpc/sysdev/xive/common.c:1161 xive_request_ipi() warn: unsigned 'xid->irq' is never less than zero.

Fixes: fd6db2892eba ("powerpc/xive: Modernize XIVE-IPI domain with an 'alloc' handler")
Cc: stable@vger.kernel.org # v5.13
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210701152412.1507612-1-clg@kaod.org

authored by

Cédric Le Goater and committed by
Michael Ellerman
3f601608 307e5042

+3 -4
+3 -4
arch/powerpc/sysdev/xive/common.c
··· 1153 1153 * Since the HW interrupt number doesn't have any meaning, 1154 1154 * simply use the node number. 1155 1155 */ 1156 - xid->irq = irq_domain_alloc_irqs(ipi_domain, 1, node, &info); 1157 - if (xid->irq < 0) { 1158 - ret = xid->irq; 1156 + ret = irq_domain_alloc_irqs(ipi_domain, 1, node, &info); 1157 + if (ret < 0) 1159 1158 goto out_free_xive_ipis; 1160 - } 1159 + xid->irq = ret; 1161 1160 1162 1161 snprintf(xid->name, sizeof(xid->name), "IPI-%d", node); 1163 1162