Message ID | 1471595114-1688-1-git-send-email-alex.shi@linaro.org |
---|---|
State | Accepted |
Commit | 59fffa34069d80662b41438b11130771b4e2a897 |
Headers | show |
Is there any comments for this patch series? Thanks! On 08/19/2016 04:25 PM, Alex Shi wrote: > This patch could reduce one branch in this function. Also > make the code more readble. > > Signed-off-by: Alex Shi <alex.shi@linaro.org> > To: linux-kernel@vger.kernel.org > To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org> > --- > drivers/base/cpu.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 691eeea..4c28e1a 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -371,12 +371,13 @@ int register_cpu(struct cpu *cpu, int num) > if (cpu->hotpluggable) > cpu->dev.groups = hotplugable_cpu_attr_groups; > error = device_register(&cpu->dev); > - if (!error) > - per_cpu(cpu_sys_devices, num) = &cpu->dev; > - if (!error) > - register_cpu_under_node(num, cpu_to_node(num)); > + if (error) > + return error; > > - return error; > + per_cpu(cpu_sys_devices, num) = &cpu->dev; > + register_cpu_under_node(num, cpu_to_node(num)); > + > + return 0; > } > > struct device *get_cpu_device(unsigned cpu) >
On 08/19/2016 10:25 AM, Alex Shi wrote: > This patch could reduce one branch in this function. Also > make the code more readble. > > Signed-off-by: Alex Shi <alex.shi@linaro.org> > To: linux-kernel@vger.kernel.org > To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org> > --- Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 691eeea..4c28e1a 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -371,12 +371,13 @@ int register_cpu(struct cpu *cpu, int num) if (cpu->hotpluggable) cpu->dev.groups = hotplugable_cpu_attr_groups; error = device_register(&cpu->dev); - if (!error) - per_cpu(cpu_sys_devices, num) = &cpu->dev; - if (!error) - register_cpu_under_node(num, cpu_to_node(num)); + if (error) + return error; - return error; + per_cpu(cpu_sys_devices, num) = &cpu->dev; + register_cpu_under_node(num, cpu_to_node(num)); + + return 0; } struct device *get_cpu_device(unsigned cpu)
This patch could reduce one branch in this function. Also make the code more readble. Signed-off-by: Alex Shi <alex.shi@linaro.org> To: linux-kernel@vger.kernel.org To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/base/cpu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.8.1.101.g72d917a