Re: [PATCH] powerpc/xive: Initialize symbol before usage
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-08-23 12:25:37
C=C3=A9dric Le Goater [off-list ref] writes:
On 08/23/2018 05:24 AM, Michael Ellerman wrote:quoted
Breno Leitao [off-list ref] writes:quoted
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xi=
ve/native.c
quoted
quoted
index 311185b9960a..fc56673a3c0f 100644--- a/arch/powerpc/sysdev/xive/native.c +++ b/arch/powerpc/sysdev/xive/native.c@@ -239,7 +239,7 @@ static bool xive_native_match(struct device_node *n=
ode)
quoted
quoted
static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc) { struct device_node *np; - unsigned int chip_id; + unsigned int chip_id =3D 0; s64 irq; =20=20 /* Find the chip ID */=20 The current code is: =20 /* Find the chip ID */ np =3D of_get_cpu_node(cpu, NULL); if (np) { if (of_property_read_u32(np, "ibm,chip-id", &chip_id) < 0) chip_id =3D 0; } =20 Where if np is NULL then we don't initialise chip_id. =20 Which could be: =20 np =3D of_get_cpu_node(cpu, NULL); if (of_property_read_u32(np, "ibm,chip-id", &chip_id) < 0) chip_id =3D 0; =20 Because of_property_read_u32() will just return an error if np is NULL. =20 It's also missing an of_node_put() of np, you should do a separate patch to fix that. You can just do it unconditionally after the of_property_read_u32().I think we can simply get rid of the OF code under xive_native_get_ipi() and use xc->chip_id instead. It should be safe to use as xive_prepare_cpu=
()=20
should have initialized ->chip_id by the time xive_native_get_ipi() is=20 called.=20
Even better! cheers