Skip to content

Commit e6403ae

Browse files
andredalexandrebelloni
authored andcommitted
rtc: max77686: use dev_err_probe() where appropriate
dev_err_probe() exists to simplify code and harmonise error messages, there's no reason not to use it here. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250304-rtc-cleanups-v2-15-d4689a71668c@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 6158c6b commit e6403ae

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

drivers/rtc/rtc-max77686.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,9 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
704704
}
705705

706706
info->regmap = dev_get_regmap(parent, NULL);
707-
if (!info->regmap) {
708-
dev_err(info->dev, "Failed to get rtc regmap\n");
709-
return -ENODEV;
710-
}
707+
if (!info->regmap)
708+
return dev_err_probe(info->dev, -ENODEV,
709+
"Failed to get rtc regmap\n");
711710

712711
if (info->drv_data->rtc_i2c_addr == MAX77686_INVALID_I2C_ADDR) {
713712
info->rtc_regmap = info->regmap;
@@ -716,28 +715,24 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
716715

717716
client = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
718717
info->drv_data->rtc_i2c_addr);
719-
if (IS_ERR(client)) {
720-
dev_err(info->dev, "Failed to allocate I2C device for RTC\n");
721-
return PTR_ERR(client);
722-
}
718+
if (IS_ERR(client))
719+
return dev_err_probe(info->dev, PTR_ERR(client),
720+
"Failed to allocate I2C device for RTC\n");
723721

724722
info->rtc_regmap = devm_regmap_init_i2c(client,
725723
info->drv_data->regmap_config);
726-
if (IS_ERR(info->rtc_regmap)) {
727-
ret = PTR_ERR(info->rtc_regmap);
728-
dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret);
729-
return ret;
730-
}
724+
if (IS_ERR(info->rtc_regmap))
725+
return dev_err_probe(info->dev, PTR_ERR(info->rtc_regmap),
726+
"Failed to allocate RTC regmap\n");
731727

732728
add_rtc_irq:
733729
ret = regmap_add_irq_chip(info->rtc_regmap, info->rtc_irq,
734730
IRQF_ONESHOT | IRQF_SHARED,
735731
0, info->drv_data->rtc_irq_chip,
736732
&info->rtc_irq_data);
737-
if (ret < 0) {
738-
dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret);
739-
return ret;
740-
}
733+
if (ret < 0)
734+
return dev_err_probe(info->dev, ret,
735+
"Failed to add RTC irq chip\n");
741736

742737
return 0;
743738
}

0 commit comments

Comments
 (0)