diff mbox series

drivers/firmware/psci: Assign @err directly in hotplug_tests()

Message ID 20200130230845.203466-1-gshan@redhat.com (mailing list archive)
State Mainlined
Commit 132330f8044c8e0cfa83b5eee41ade52708390dc
Headers show
Series drivers/firmware/psci: Assign @err directly in hotplug_tests() | expand

Commit Message

Gavin Shan Jan. 30, 2020, 11:08 p.m. UTC
The return value of down_and_up_cpus() can be assigned to @err directly.
With that, the useless assignment to @err with zero can be dropped.

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
 drivers/firmware/psci/psci_checker.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Sudeep Holla Jan. 31, 2020, 3:36 p.m. UTC | #1
On Fri, Jan 31, 2020 at 10:08:45AM +1100, Gavin Shan wrote:
> The return value of down_and_up_cpus() can be assigned to @err directly.
> With that, the useless assignment to @err with zero can be dropped.
>

Yes, I was wondering why it's done like this. It may be result of some
refactoring that we ended up with this. Anyways, looks good to me.

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep
Gavin Shan Feb. 2, 2020, 10:17 p.m. UTC | #2
On 2/1/20 2:36 AM, Sudeep Holla wrote:
> On Fri, Jan 31, 2020 at 10:08:45AM +1100, Gavin Shan wrote:
>> The return value of down_and_up_cpus() can be assigned to @err directly.
>> With that, the useless assignment to @err with zero can be dropped.
>>
> 
> Yes, I was wondering why it's done like this. It may be result of some
> refactoring that we ended up with this. Anyways, looks good to me.
> 
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> 

Thanks, Sudeep. Yeah, It was introduced by commit ea8b1c4a6019
("drivers: psci: PSCI checker module").

Thanks,
Gavin
diff mbox series

Patch

diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c
index 03eb798ad3ed..0e1c92e2f91a 100644
--- a/drivers/firmware/psci/psci_checker.c
+++ b/drivers/firmware/psci/psci_checker.c
@@ -199,13 +199,12 @@  static int hotplug_tests(void)
 	if (!page_buf)
 		goto out_free_cpu_groups;
 
-	err = 0;
 	/*
 	 * Of course the last CPU cannot be powered down and cpu_down() should
 	 * refuse doing that.
 	 */
 	pr_info("Trying to turn off and on again all CPUs\n");
-	err += down_and_up_cpus(cpu_online_mask, offlined_cpus);
+	err = down_and_up_cpus(cpu_online_mask, offlined_cpus);
 
 	/*
 	 * Take down CPUs by cpu group this time. When the last CPU is turned