diff mbox

powercap: Remove reassignment

Message ID 00329a239c8b1640a9e491b6a90a5b20fd45e42c.1510422357.git.arvind.yadav.cs@gmail.com (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show

Commit Message

Arvind Yadav Nov. 11, 2017, 5:47 p.m. UTC
It is not necessary to reassignment of 'result'.
Here, result is being initialized zero and then updated with
seed_constraint_attributes().
class_register is enough to return successful and error value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/powercap/powercap_sys.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Rafael J. Wysocki Dec. 13, 2017, 1:03 a.m. UTC | #1
On Saturday, November 11, 2017 6:47:26 PM CET Arvind Yadav wrote:
> It is not necessary to reassignment of 'result'.
> Here, result is being initialized zero and then updated with
> seed_constraint_attributes().
> class_register is enough to return successful and error value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/powercap/powercap_sys.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
> index 5b10b50..64b2b25 100644
> --- a/drivers/powercap/powercap_sys.c
> +++ b/drivers/powercap/powercap_sys.c
> @@ -673,15 +673,13 @@ EXPORT_SYMBOL_GPL(powercap_unregister_control_type);
>  
>  static int __init powercap_init(void)
>  {
> -	int result = 0;
> +	int result;
>  
>  	result = seed_constraint_attributes();
>  	if (result)
>  		return result;
>  
> -	result = class_register(&powercap_class);
> -
> -	return result;
> +	return class_register(&powercap_class);
>  }
>  
>  device_initcall(powercap_init);
> 

Applied, thanks!
diff mbox

Patch

diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
index 5b10b50..64b2b25 100644
--- a/drivers/powercap/powercap_sys.c
+++ b/drivers/powercap/powercap_sys.c
@@ -673,15 +673,13 @@  EXPORT_SYMBOL_GPL(powercap_unregister_control_type);
 
 static int __init powercap_init(void)
 {
-	int result = 0;
+	int result;
 
 	result = seed_constraint_attributes();
 	if (result)
 		return result;
 
-	result = class_register(&powercap_class);
-
-	return result;
+	return class_register(&powercap_class);
 }
 
 device_initcall(powercap_init);