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

rtc: s5m: convert to 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-16-d4689a71668c@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

André Draszik and committed by
Alexandre Belloni
0c57c2e7 e6403ae5

+21 -29
+21 -29
drivers/rtc/rtc-s5m.c
··· 626 626 } 627 627 628 628 info->rtc_24hr_mode = 1; 629 - if (ret < 0) { 630 - dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", 631 - __func__, ret); 632 - return ret; 633 - } 629 + if (ret < 0) 630 + return dev_err_probe(info->dev, ret, 631 + "%s: fail to write controlm reg\n", 632 + __func__); 634 633 635 634 return ret; 636 635 } ··· 668 669 alarm_irq = S5M8767_IRQ_RTCA1; 669 670 break; 670 671 default: 671 - dev_err(&pdev->dev, 672 - "Device type %lu is not supported by RTC driver\n", 673 - platform_get_device_id(pdev)->driver_data); 674 - return -ENODEV; 672 + return dev_err_probe(&pdev->dev, -ENODEV, 673 + "Device type %lu is not supported by RTC driver\n", 674 + platform_get_device_id(pdev)->driver_data); 675 675 } 676 676 677 677 i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter, 678 678 RTC_I2C_ADDR); 679 - if (IS_ERR(i2c)) { 680 - dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n"); 681 - return PTR_ERR(i2c); 682 - } 679 + if (IS_ERR(i2c)) 680 + return dev_err_probe(&pdev->dev, PTR_ERR(i2c), 681 + "Failed to allocate I2C for RTC\n"); 683 682 684 683 info->regmap = devm_regmap_init_i2c(i2c, regmap_cfg); 685 - if (IS_ERR(info->regmap)) { 686 - ret = PTR_ERR(info->regmap); 687 - dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n", 688 - ret); 689 - return ret; 690 - } 684 + if (IS_ERR(info->regmap)) 685 + return dev_err_probe(&pdev->dev, PTR_ERR(info->regmap), 686 + "Failed to allocate RTC register map\n"); 691 687 692 688 info->dev = &pdev->dev; 693 689 info->s5m87xx = s5m87xx; ··· 690 696 691 697 if (s5m87xx->irq_data) { 692 698 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); 693 - if (info->irq <= 0) { 694 - dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", 695 - alarm_irq); 696 - return -EINVAL; 697 - } 699 + if (info->irq <= 0) 700 + return dev_err_probe(&pdev->dev, -EINVAL, 701 + "Failed to get virtual IRQ %d\n", 702 + alarm_irq); 698 703 } 699 704 700 705 platform_set_drvdata(pdev, info); ··· 717 724 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, 718 725 s5m_rtc_alarm_irq, 0, "rtc-alarm0", 719 726 info); 720 - if (ret < 0) { 721 - dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", 722 - info->irq, ret); 723 - return ret; 724 - } 727 + if (ret < 0) 728 + return dev_err_probe(&pdev->dev, ret, 729 + "Failed to request alarm IRQ %d\n", 730 + info->irq); 725 731 device_init_wakeup(&pdev->dev, true); 726 732 } 727 733