diff mbox

[12/15] power-supply: Use PTR_ERR_OR_ZERO() routine

Message ID 50c6a288bc4a7b767fcdc13bb946454b35ad7e24.1409831636.git.viresh.kumar@linaro.org
State Accepted
Commit 9d2410c79b5b2dd741648de26ad52ffd2ce3dc01
Headers show

Commit Message

Viresh Kumar Sept. 4, 2014, 12:01 p.m. UTC
At multiple places we are doing exactly what PTR_ERR_OR_ZERO() does. And so that
routine can be reused instead of increasing lines of code here.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/power/power_supply_core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 26518c8..376464e 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -435,9 +435,7 @@  static int psy_register_thermal(struct power_supply *psy)
 		if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) {
 			psy->tzd = thermal_zone_device_register(psy->name, 0, 0,
 					psy, &psy_tzd_ops, NULL, 0, 0);
-			if (IS_ERR(psy->tzd))
-				return PTR_ERR(psy->tzd);
-			break;
+			return PTR_ERR_OR_ZERO(psy->tzd);
 		}
 	}
 	return 0;
@@ -515,9 +513,7 @@  static int psy_register_cooler(struct power_supply *psy)
 			psy->tcd = thermal_cooling_device_register(
 							(char *)psy->name,
 							psy, &psy_tcd_ops);
-			if (IS_ERR(psy->tcd))
-				return PTR_ERR(psy->tcd);
-			break;
+			return PTR_ERR_OR_ZERO(psy->tcd);
 		}
 	}
 	return 0;