Re: [PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case

2020-01-12 Thread David Gibson
On Fri, Jan 10, 2020 at 10:50:55AM +0100, Greg Kurz wrote: > On Fri, 10 Jan 2020 10:34:07 +0100 > Philippe Mathieu-Daudé wrote: > > > On 1/9/20 6:43 PM, Greg Kurz wrote: > > > On Thu, 9 Jan 2020 16:21:22 +0100 > > > Philippe Mathieu-Daudé wrote: > > > > > >> We only access these variables in R

Re: [PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case

2020-01-10 Thread Eric Blake
On 1/10/20 3:50 AM, Greg Kurz wrote: I guess a decent compiler can be smart enough detect that the initialization isn't needed outside of the RTAS_SYSPARM_SPLPAR_CHARACTERISTICS branch... Anyway, reducing scope isn't bad. The only hitch I could see is that some people do prefer to have all varia

Re: [PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case

2020-01-10 Thread Greg Kurz
On Fri, 10 Jan 2020 10:34:07 +0100 Philippe Mathieu-Daudé wrote: > On 1/9/20 6:43 PM, Greg Kurz wrote: > > On Thu, 9 Jan 2020 16:21:22 +0100 > > Philippe Mathieu-Daudé wrote: > > > >> We only access these variables in RTAS_SYSPARM_SPLPAR_CHARACTERISTICS > >> case, restrict their scope to avoid

Re: [PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case

2020-01-10 Thread Philippe Mathieu-Daudé
On 1/9/20 6:43 PM, Greg Kurz wrote: On Thu, 9 Jan 2020 16:21:22 +0100 Philippe Mathieu-Daudé wrote: We only access these variables in RTAS_SYSPARM_SPLPAR_CHARACTERISTICS case, restrict their scope to avoid unnecessary initialization. I guess a decent compiler can be smart enough detect tha

Re: [PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case

2020-01-09 Thread Greg Kurz
On Thu, 9 Jan 2020 16:21:22 +0100 Philippe Mathieu-Daudé wrote: > We only access these variables in RTAS_SYSPARM_SPLPAR_CHARACTERISTICS > case, restrict their scope to avoid unnecessary initialization. > I guess a decent compiler can be smart enough detect that the initialization isn't needed

[PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case

2020-01-09 Thread Philippe Mathieu-Daudé
We only access these variables in RTAS_SYSPARM_SPLPAR_CHARACTERISTICS case, restrict their scope to avoid unnecessary initialization. Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/spapr_rtas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc