Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

André Draszik and committed by
Alexandre Belloni
e6403ae5 6158c6b8

+12 -17
+12 -17
drivers/rtc/rtc-max77686.c
··· 704 704 } 705 705 706 706 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"); 711 710 712 711 if (info->drv_data->rtc_i2c_addr == MAX77686_INVALID_I2C_ADDR) { 713 712 info->rtc_regmap = info->regmap; ··· 715 716 716 717 client = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter, 717 718 info->drv_data->rtc_i2c_addr); 718 - if (IS_ERR(client)) { 719 - dev_err(info->dev, "Failed to allocate I2C device for RTC\n"); 720 - return PTR_ERR(client); 721 - } 719 + if (IS_ERR(client)) 720 + return dev_err_probe(info->dev, PTR_ERR(client), 721 + "Failed to allocate I2C device for RTC\n"); 722 722 723 723 info->rtc_regmap = devm_regmap_init_i2c(client, 724 724 info->drv_data->regmap_config); 725 - if (IS_ERR(info->rtc_regmap)) { 726 - ret = PTR_ERR(info->rtc_regmap); 727 - dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret); 728 - return ret; 729 - } 725 + if (IS_ERR(info->rtc_regmap)) 726 + return dev_err_probe(info->dev, PTR_ERR(info->rtc_regmap), 727 + "Failed to allocate RTC regmap\n"); 730 728 731 729 add_rtc_irq: 732 730 ret = regmap_add_irq_chip(info->rtc_regmap, info->rtc_irq, 733 731 IRQF_ONESHOT | IRQF_SHARED, 734 732 0, info->drv_data->rtc_irq_chip, 735 733 &info->rtc_irq_data); 736 - if (ret < 0) { 737 - dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret); 738 - return ret; 739 - } 734 + if (ret < 0) 735 + return dev_err_probe(info->dev, ret, 736 + "Failed to add RTC irq chip\n"); 740 737 741 738 return 0; 742 739 }