Skip to content

Commit

Permalink
power-supply: Use PTR_ERR_OR_ZERO() routine
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Viresh Kumar authored and Sebastian Reichel committed Sep 16, 2014
1 parent 061f380 commit 9d2410c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/power/power_supply_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9d2410c

Please sign in to comment.