diff options
author | Breno Leitao <breno.leitao@gmail.com> | 2018-08-23 19:26:39 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-09-19 07:58:09 -0400 |
commit | 8ac9e5bfd8cf41ef106ac97267117e5209627c74 (patch) | |
tree | f40cab0b1fdd7cd64c4c335e0abdfbe04da48d65 | |
parent | 6f8e45f7eb1bee5efdbe4a9cfe4a45627403c5fb (diff) |
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: Breno Leitao <leitao@debian.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
[mpe: Tweak change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/sysdev/xive/native.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c index 5b20a678d755..1ca127d052a6 100644 --- a/arch/powerpc/sysdev/xive/native.c +++ b/arch/powerpc/sysdev/xive/native.c | |||
@@ -238,20 +238,11 @@ static bool xive_native_match(struct device_node *node) | |||
238 | #ifdef CONFIG_SMP | 238 | #ifdef CONFIG_SMP |
239 | static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc) | 239 | static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc) |
240 | { | 240 | { |
241 | struct device_node *np; | ||
242 | unsigned int chip_id; | ||
243 | s64 irq; | 241 | s64 irq; |
244 | 242 | ||
245 | /* Find the chip ID */ | ||
246 | np = of_get_cpu_node(cpu, NULL); | ||
247 | if (np) { | ||
248 | if (of_property_read_u32(np, "ibm,chip-id", &chip_id) < 0) | ||
249 | chip_id = 0; | ||
250 | } | ||
251 | |||
252 | /* Allocate an IPI and populate info about it */ | 243 | /* Allocate an IPI and populate info about it */ |
253 | for (;;) { | 244 | for (;;) { |
254 | irq = opal_xive_allocate_irq(chip_id); | 245 | irq = opal_xive_allocate_irq(xc->chip_id); |
255 | if (irq == OPAL_BUSY) { | 246 | if (irq == OPAL_BUSY) { |
256 | msleep(OPAL_BUSY_DELAY_MS); | 247 | msleep(OPAL_BUSY_DELAY_MS); |
257 | continue; | 248 | continue; |