summaryrefslogtreecommitdiff
path: root/drivers/power/supply/sbs-battery.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-04-29 01:43:58 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-04-29 01:43:58 +0300
commit5a69e9bce9984806029926f405b4517878e703e2 (patch)
tree97d3a817b17a3f8a2e7d6099c6d96bcb67d1cd66 /drivers/power/supply/sbs-battery.c
parenta8b5e037d8a00d396377a97f08f5fd2a410b96a1 (diff)
parentd0a43c12ee9f57ddb284272187bd18726c2c2c98 (diff)
downloadlinux-5a69e9bce9984806029926f405b4517878e703e2.tar.xz
Merge tag 'for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: "battery/charger driver changes: - core: - provide function stubs if CONFIG_POWER_SUPPLY=n - reduce loglevel for probe defer info - surface: - new battery and charger drivers for Surface - bq27xxx: - add bq78z100 support - fix current_now/power_avg for newer chips - cw2015: - add CHARGE_NOW support - ab8500: - drop pdata support - convert most DT bindings to YAML - lots of minor fixes and cleanups reset drivers: - ltc2952-poweroff: - make trigger delay configurable from DT - minor fixes and cleanups" * tag 'for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (97 commits) power: supply: cpcap-battery: fix invalid usage of list cursor power: supply: bq256xx: add kerneldoc for structure members power: supply: act8945a: correct kerneldoc power: supply: max17040: remove unneeded double cast power: supply: max17040: handle device_property_read_u8_array() failure power: supply: max14577: remove unneeded variable initialization power: supply: surface-charger: Make symbol 'surface_ac_pm_ops' static power: supply: surface-battery: Make some symbols static power: reset: restart-poweroff: Add missing MODULE_DEVICE_TABLE power: reset: hisi-reboot: add missing MODULE_DEVICE_TABLE power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove() power: supply: generic-adc-battery: fix possible use-after-free in gab_remove() power: supply: Add AC driver for Surface Aggregator Module power: supply: Add battery driver for Surface Aggregator Module power: supply: bq25980: Move props from battery node power: supply: core: Use true and false for bool variable power: supply: goldfish: Remove the GOLDFISH dependency power: reset: ltc2952: make trigger delay configurable power: supply: cpcap-charger: Simplify bool conversion power: supply: cpcap-charger: Add usleep to cpcap charger to avoid usb plug bounce ...
Diffstat (limited to 'drivers/power/supply/sbs-battery.c')
-rw-r--r--drivers/power/supply/sbs-battery.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 70ea404b2a36..8d7a10730e43 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -1124,11 +1124,9 @@ static int sbs_probe(struct i2c_client *client)
chip->gpio_detect = devm_gpiod_get_optional(&client->dev,
"sbs,battery-detect", GPIOD_IN);
- if (IS_ERR(chip->gpio_detect)) {
- dev_err(&client->dev, "Failed to get gpio: %ld\n",
- PTR_ERR(chip->gpio_detect));
- return PTR_ERR(chip->gpio_detect);
- }
+ if (IS_ERR(chip->gpio_detect))
+ return dev_err_probe(&client->dev, PTR_ERR(chip->gpio_detect),
+ "Failed to get gpio\n");
i2c_set_clientdata(client, chip);
@@ -1159,11 +1157,9 @@ skip_gpio:
rc = sbs_get_battery_presence_and_health(
client, POWER_SUPPLY_PROP_PRESENT, &val);
- if (rc < 0 || !val.intval) {
- dev_err(&client->dev, "Failed to get present status\n");
- rc = -ENODEV;
- goto exit_psupply;
- }
+ if (rc < 0 || !val.intval)
+ return dev_err_probe(&client->dev, -ENODEV,
+ "Failed to get present status\n");
}
rc = devm_delayed_work_autocancel(&client->dev, &chip->work,
@@ -1173,20 +1169,14 @@ skip_gpio:
chip->power_supply = devm_power_supply_register(&client->dev, sbs_desc,
&psy_cfg);
- if (IS_ERR(chip->power_supply)) {
- dev_err(&client->dev,
- "%s: Failed to register power supply\n", __func__);
- rc = PTR_ERR(chip->power_supply);
- goto exit_psupply;
- }
+ if (IS_ERR(chip->power_supply))
+ return dev_err_probe(&client->dev, PTR_ERR(chip->power_supply),
+ "Failed to register power supply\n");
dev_info(&client->dev,
"%s: battery gas gauge device registered\n", client->name);
return 0;
-
-exit_psupply:
- return rc;
}
#if defined CONFIG_PM_SLEEP