diff options
author | Matti Vaittinen <mazziesaccount@gmail.com> | 2022-11-23 11:19:49 +0200 |
---|---|---|
committer | Lee Jones <lee@kernel.org> | 2022-12-08 13:52:58 +0000 |
commit | cb83cb0dfa821b9c91cc9b2e3473f0ea42e11461 (patch) | |
tree | 9ba7cd76ee4a74e2f2f1cc98521135cdfebc3aaf /drivers/mfd/rohm-bd71828.c | |
parent | 96836a35ffb3bcdf412d5753363daf5ee3e68548 (diff) |
mfd: rohm: Use dev_err_probe()
The dev_err_probe() has (at least) following benefits over dev_err()
when printing an error print for a failed function call at a device
driver probe:
- Omit error level print if error is 'EPRBE_DEFER'
- Standardized print format for returned error
- return the error value allowing shortening calls like:
if (ret) {
dev_err(...);
return ret;
}
to
if (ret)
return dev_err_probe(...);
Convert the ROHM BD71828, ROHM BD718x7 and ROHM BD9576 core drivers to
use the dev_err_probe() when returned error is not hard-coded constant.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/Y33lte0PKd2u6dyR@fedora
Diffstat (limited to 'drivers/mfd/rohm-bd71828.c')
-rw-r--r-- | drivers/mfd/rohm-bd71828.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c index 3c5c6c393650..7eb920633ee9 100644 --- a/drivers/mfd/rohm-bd71828.c +++ b/drivers/mfd/rohm-bd71828.c @@ -513,27 +513,24 @@ static int bd71828_i2c_probe(struct i2c_client *i2c) } regmap = devm_regmap_init_i2c(i2c, regmap_config); - if (IS_ERR(regmap)) { - dev_err(&i2c->dev, "Failed to initialize Regmap\n"); - return PTR_ERR(regmap); - } + if (IS_ERR(regmap)) + return dev_err_probe(&i2c->dev, PTR_ERR(regmap), + "Failed to initialize Regmap\n"); ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq, IRQF_ONESHOT, 0, irqchip, &irq_data); - if (ret) { - dev_err(&i2c->dev, "Failed to add IRQ chip\n"); - return ret; - } + if (ret) + return dev_err_probe(&i2c->dev, ret, + "Failed to add IRQ chip\n"); dev_dbg(&i2c->dev, "Registered %d IRQs for chip\n", irqchip->num_irqs); if (button_irq) { ret = regmap_irq_get_virq(irq_data, button_irq); - if (ret < 0) { - dev_err(&i2c->dev, "Failed to get the power-key IRQ\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(&i2c->dev, ret, + "Failed to get the power-key IRQ\n"); button.irq = ret; } @@ -545,7 +542,7 @@ static int bd71828_i2c_probe(struct i2c_client *i2c) ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, mfd, cells, NULL, 0, regmap_irq_get_domain(irq_data)); if (ret) - dev_err(&i2c->dev, "Failed to create subdevices\n"); + dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); return ret; } |