diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-09-04 08:01:33 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2014-09-16 05:01:36 -0400 |
commit | 9d2410c79b5b2dd741648de26ad52ffd2ce3dc01 (patch) | |
tree | 857d401fb979d740b15faefc681d83468b128a5a | |
parent | 061f3806bbe4d8e86dddf101f75f49c38d3f1669 (diff) |
power-supply: Use PTR_ERR_OR_ZERO() routine
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>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
-rw-r--r-- | drivers/power/power_supply_core.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 26518c8218ea..376464e33fc8 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) | |||
435 | if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { | 435 | if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { |
436 | psy->tzd = thermal_zone_device_register(psy->name, 0, 0, | 436 | psy->tzd = thermal_zone_device_register(psy->name, 0, 0, |
437 | psy, &psy_tzd_ops, NULL, 0, 0); | 437 | psy, &psy_tzd_ops, NULL, 0, 0); |
438 | if (IS_ERR(psy->tzd)) | 438 | return PTR_ERR_OR_ZERO(psy->tzd); |
439 | return PTR_ERR(psy->tzd); | ||
440 | break; | ||
441 | } | 439 | } |
442 | } | 440 | } |
443 | return 0; | 441 | return 0; |
@@ -515,9 +513,7 @@ static int psy_register_cooler(struct power_supply *psy) | |||
515 | psy->tcd = thermal_cooling_device_register( | 513 | psy->tcd = thermal_cooling_device_register( |
516 | (char *)psy->name, | 514 | (char *)psy->name, |
517 | psy, &psy_tcd_ops); | 515 | psy, &psy_tcd_ops); |
518 | if (IS_ERR(psy->tcd)) | 516 | return PTR_ERR_OR_ZERO(psy->tcd); |
519 | return PTR_ERR(psy->tcd); | ||
520 | break; | ||
521 | } | 517 | } |
522 | } | 518 | } |
523 | return 0; | 519 | return 0; |