Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions drivers/power/supply/macsmc-power.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ static int macsmc_battery_set_charge_behaviour(struct macsmc_power *power, int v
static int macsmc_battery_get_date(const char *s, int *out)
{
if (!isdigit(s[0]) || !isdigit(s[1]))
return -EOPNOTSUPP;
return -ENODATA;

*out = (s[0] - '0') * 10 + s[1] - '0';
return 0;
Expand Down Expand Up @@ -760,7 +760,8 @@ static int macsmc_battery_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_MANUFACTURE_YEAR:
ret = macsmc_battery_get_date(&power->mfg_date[0], &val->intval);
/* The SMC reports the manufacture year as an offset from 1992. */
val->intval += 1992;
if (!ret)
val->intval += 1992;
break;
case POWER_SUPPLY_PROP_MANUFACTURE_MONTH:
ret = macsmc_battery_get_date(&power->mfg_date[2], &val->intval);
Expand Down
Loading