Skip to contentSkip to conversation

extcon-max8997: remove usage of ret in max8997_muic_handle_charger_type_detach

PATCH In review Devendra Naga 1 participant 2 messages Aug 15, 2012 – Aug 31, 2012 External connector subsystem (extcon)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extcon-max8997: remove usage of ret in max8997_muic_handle_charger_type_detach

actually we can do returns with error or success with out ret in this function, so remove the ret variable, and reduce a very little (4byte) space on stack of this function

---
compile tested.

 drivers/extcon/extcon-max8997.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/extcon/extcon-max8997.c +2 -4
index ef9090a..77b66b0 100644
@@ -271,8 +271,6 @@ out:
 static int max8997_muic_handle_charger_type_detach(
 				struct max8997_muic_info *info)
 {
-	int ret = 0;
-
 	switch (info->pre_charger_type) {
 	case MAX8997_CHARGER_TYPE_USB:
 		extcon_set_cable_state(info->edev, "USB", false);
@@ -290,11 +288,11 @@ static int max8997_muic_handle_charger_type_detach(
 		extcon_set_cable_state(info->edev, "Fast-charger", false);
 		break;
 	default:
-		ret = -EINVAL;
+		return -EINVAL;
 		break;
 	}
 
-	return ret;
+	return 0;
 }
 
 static int max8997_muic_handle_charger_type(struct max8997_muic_info *info,
Signature · 1 line
1.7.12.rc2
#1 lore raw

any comments ?

Quoted 40 lines · Devendra Naga

actually we can do returns with error or success with out ret in this function, so remove the ret variable, and reduce a very little (4byte) space on stack of this function

---
compile tested.

 drivers/extcon/extcon-max8997.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/extcon/extcon-max8997.c +2 -5
index ef9090a..77b66b0 100644
@@ -271,8 +271,6 @@ out:
 static int max8997_muic_handle_charger_type_detach(
                                struct max8997_muic_info *info)
 {
-       int ret = 0;
-
        switch (info->pre_charger_type) {
        case MAX8997_CHARGER_TYPE_USB:
                extcon_set_cable_state(info->edev, "USB", false);
@@ -290,11 +288,11 @@ static int max8997_muic_handle_charger_type_detach(
                extcon_set_cable_state(info->edev, "Fast-charger", false);
                break;
        default:
-               ret = -EINVAL;
+               return -EINVAL;
                break;
        }
 
-       return ret;
+       return 0;
 }
 
 static int max8997_muic_handle_charger_type(struct max8997_muic_info *info,
--

1.7.12.rc2