Commit 8ac9e5bf authored by Breno Leitao's avatar Breno Leitao Committed by Michael Ellerman

powerpc/xive: Use xive_cpu->chip_id instead of looking it up again

Function xive_native_get_ipi() might use chip_id without it being
initialized, if the CPU node is not found, as reported by smatch:

  error: uninitialized symbol 'chip_id'

As suggested by Cédric, we can use xc->chip_id instead of consulting
the device tree for chip id, which is safe since xive_prepare_cpu()
should have initialized ->chip_id by the time xive_native_get_ipi() is
called.
Signed-off-by: default avatarBreno Leitao <leitao@debian.org>
Reviewed-by: default avatarCédric Le Goater <clg@kaod.org>
[mpe: Tweak change log]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 6f8e45f7
...@@ -238,20 +238,11 @@ static bool xive_native_match(struct device_node *node) ...@@ -238,20 +238,11 @@ static bool xive_native_match(struct device_node *node)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc) static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc)
{ {
struct device_node *np;
unsigned int chip_id;
s64 irq; s64 irq;
/* Find the chip ID */
np = of_get_cpu_node(cpu, NULL);
if (np) {
if (of_property_read_u32(np, "ibm,chip-id", &chip_id) < 0)
chip_id = 0;
}
/* Allocate an IPI and populate info about it */ /* Allocate an IPI and populate info about it */
for (;;) { for (;;) {
irq = opal_xive_allocate_irq(chip_id); irq = opal_xive_allocate_irq(xc->chip_id);
if (irq == OPAL_BUSY) { if (irq == OPAL_BUSY) {
msleep(OPAL_BUSY_DELAY_MS); msleep(OPAL_BUSY_DELAY_MS);
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment