diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-01 17:57:23 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-01 17:57:23 -0400 |
| commit | 600d7258316d87cf9ecd58b6fdc8a35deca0870c (patch) | |
| tree | 6efafe931e3e8c3a518093f17e9747ec8525b90d | |
| parent | 65beea4c3a526320b019ca5c010da41533dafaf5 (diff) | |
| parent | 349ced9984ff540ce74ca8a0b2e9b03dc434b9dd (diff) | |
Merge tag 'for-v5.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply fixes from Sebastian Reichel:
"Two more fixes for the 5.1 cycle.
One division by zero fix in a specific driver and one core workaround
for bad userspace behaviour from systemd regarding uevents. IMHO this
can be considered to be a userspace bug, but the debug messages are
useless anyways
- cpcap-battery: fix a division by zero
- core: fix systemd issue due to log messages produced by uevent"
* tag 'for-v5.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
power: supply: sysfs: prevent endless uevent loop with CONFIG_POWER_SUPPLY_DEBUG
power: supply: cpcap-battery: Fix division by zero
| -rw-r--r-- | drivers/power/supply/cpcap-battery.c | 3 | ||||
| -rw-r--r-- | drivers/power/supply/power_supply_sysfs.c | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c index 08d5037fd052..6887870ba32c 100644 --- a/drivers/power/supply/cpcap-battery.c +++ b/drivers/power/supply/cpcap-battery.c | |||
| @@ -221,6 +221,9 @@ static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata, | |||
| 221 | int avg_current; | 221 | int avg_current; |
| 222 | u32 cc_lsb; | 222 | u32 cc_lsb; |
| 223 | 223 | ||
| 224 | if (!divider) | ||
| 225 | return 0; | ||
| 226 | |||
| 224 | sample &= 0xffffff; /* 24-bits, unsigned */ | 227 | sample &= 0xffffff; /* 24-bits, unsigned */ |
| 225 | offset &= 0x7ff; /* 10-bits, signed */ | 228 | offset &= 0x7ff; /* 10-bits, signed */ |
| 226 | 229 | ||
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index dce24f596160..5358a80d854f 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c | |||
| @@ -383,15 +383,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 383 | char *prop_buf; | 383 | char *prop_buf; |
| 384 | char *attrname; | 384 | char *attrname; |
| 385 | 385 | ||
| 386 | dev_dbg(dev, "uevent\n"); | ||
| 387 | |||
| 388 | if (!psy || !psy->desc) { | 386 | if (!psy || !psy->desc) { |
| 389 | dev_dbg(dev, "No power supply yet\n"); | 387 | dev_dbg(dev, "No power supply yet\n"); |
| 390 | return ret; | 388 | return ret; |
| 391 | } | 389 | } |
| 392 | 390 | ||
| 393 | dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name); | ||
| 394 | |||
| 395 | ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name); | 391 | ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name); |
| 396 | if (ret) | 392 | if (ret) |
| 397 | return ret; | 393 | return ret; |
| @@ -427,8 +423,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 427 | goto out; | 423 | goto out; |
| 428 | } | 424 | } |
| 429 | 425 | ||
| 430 | dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf); | ||
| 431 | |||
| 432 | ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf); | 426 | ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf); |
| 433 | kfree(attrname); | 427 | kfree(attrname); |
| 434 | if (ret) | 428 | if (ret) |
