summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorSebastian Reichel <sebastian.reichel@collabora.com>2021-03-09 19:04:02 +0100
committerSebastian Reichel <sebastian.reichel@collabora.com>2021-04-02 14:19:25 +0200
commite319f4e25a7db549c0b05a273cb23ecc575be9c2 (patch)
tree2440e5bc83780a534c5ee163068aac69c1cc62da /drivers/power
parentpower: supply: sbs-battery: use dev_err_probe (diff)
downloadlinux-e319f4e25a7db549c0b05a273cb23ecc575be9c2.tar.xz
linux-e319f4e25a7db549c0b05a273cb23ecc575be9c2.zip
power: supply: sbs-charger: use dev_err_probe
Introduce usage of dev_err_probe in probe routine, which makes the code slightly more readable and removes some lines of code. It also removes PROBE_DEFER errors being logged by default. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/sbs-charger.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/power/supply/sbs-charger.c b/drivers/power/supply/sbs-charger.c
index fbfb6a620961..36a048d687e0 100644
--- a/drivers/power/supply/sbs-charger.c
+++ b/drivers/power/supply/sbs-charger.c
@@ -189,18 +189,14 @@ static int sbs_probe(struct i2c_client *client,
* to the battery.
*/
ret = regmap_read(chip->regmap, SBS_CHARGER_REG_STATUS, &val);
- if (ret) {
- dev_err(&client->dev, "Failed to get device status\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "Failed to get device status\n");
chip->last_state = val;
- chip->power_supply = devm_power_supply_register(&client->dev, &sbs_desc,
- &psy_cfg);
- if (IS_ERR(chip->power_supply)) {
- dev_err(&client->dev, "Failed to register power supply\n");
- return PTR_ERR(chip->power_supply);
- }
+ chip->power_supply = devm_power_supply_register(&client->dev, &sbs_desc, &psy_cfg);
+ if (IS_ERR(chip->power_supply))
+ return dev_err_probe(&client->dev, PTR_ERR(chip->power_supply),
+ "Failed to register power supply\n");
/*
* The sbs-charger spec doesn't impose the use of an interrupt. So in
@@ -212,10 +208,8 @@ static int sbs_probe(struct i2c_client *client,
NULL, sbs_irq_thread,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
dev_name(&client->dev), chip);
- if (ret) {
- dev_err(&client->dev, "Failed to request irq, %d\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "Failed to request irq\n");
} else {
INIT_DELAYED_WORK(&chip->work, sbs_delayed_work);
schedule_delayed_work(&chip->work,