Re: [PATCH] rtc: s5m: use devm_i2c_new_dummy_device()

From: kernel test robot
Date: Wed Jan 06 2021 - 01:47:56 EST


Hi Bartosz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.11-rc2 next-20210104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/rtc-s5m-use-devm_i2c_new_dummy_device/20210105-214736
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: x86_64-randconfig-a004-20210105 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/21651184178d1001f3bbc858c9161f1b7fd65321
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bartosz-Golaszewski/rtc-s5m-use-devm_i2c_new_dummy_device/20210105-214736
git checkout 21651184178d1001f3bbc858c9161f1b7fd65321
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/rtc/rtc-s5m.c:773:4: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
ret);
^~~
include/linux/dev_printk.h:112:32: note: expanded from macro 'dev_err'
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
drivers/rtc/rtc-s5m.c:719:9: note: initialize the variable 'ret' to silence this warning
int ret, alarm_irq;
^
= 0
1 warning generated.


vim +/ret +773 drivers/rtc/rtc-s5m.c

5bccae6ec45870 Sangbeom Kim 2013-11-12 712
5bccae6ec45870 Sangbeom Kim 2013-11-12 713 static int s5m_rtc_probe(struct platform_device *pdev)
5bccae6ec45870 Sangbeom Kim 2013-11-12 714 {
5bccae6ec45870 Sangbeom Kim 2013-11-12 715 struct sec_pmic_dev *s5m87xx = dev_get_drvdata(pdev->dev.parent);
5bccae6ec45870 Sangbeom Kim 2013-11-12 716 struct sec_platform_data *pdata = s5m87xx->pdata;
5bccae6ec45870 Sangbeom Kim 2013-11-12 717 struct s5m_rtc_info *info;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 718 const struct regmap_config *regmap_cfg;
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 719 int ret, alarm_irq;
5bccae6ec45870 Sangbeom Kim 2013-11-12 720
5bccae6ec45870 Sangbeom Kim 2013-11-12 721 if (!pdata) {
5bccae6ec45870 Sangbeom Kim 2013-11-12 722 dev_err(pdev->dev.parent, "Platform data not supplied\n");
5bccae6ec45870 Sangbeom Kim 2013-11-12 723 return -ENODEV;
5bccae6ec45870 Sangbeom Kim 2013-11-12 724 }
5bccae6ec45870 Sangbeom Kim 2013-11-12 725
5bccae6ec45870 Sangbeom Kim 2013-11-12 726 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
5bccae6ec45870 Sangbeom Kim 2013-11-12 727 if (!info)
5bccae6ec45870 Sangbeom Kim 2013-11-12 728 return -ENOMEM;
5bccae6ec45870 Sangbeom Kim 2013-11-12 729
94f919225890a1 Krzysztof Kozlowski 2015-04-16 730 switch (platform_get_device_id(pdev)->driver_data) {
a65e5efa7c5faa Alim Akhtar 2015-11-20 731 case S2MPS15X:
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 732 regmap_cfg = &s2mps14_rtc_regmap_config;
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 733 info->regs = &s2mps15_rtc_regs;
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 734 alarm_irq = S2MPS14_IRQ_RTCA0;
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 735 break;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 736 case S2MPS14X:
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 737 regmap_cfg = &s2mps14_rtc_regmap_config;
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 738 info->regs = &s2mps14_rtc_regs;
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 739 alarm_irq = S2MPS14_IRQ_RTCA0;
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 740 break;
5281f94ae7f54d Krzysztof Kozlowski 2015-04-16 741 case S2MPS13X:
e349c910e2398c Krzysztof Kozlowski 2014-04-14 742 regmap_cfg = &s2mps14_rtc_regmap_config;
8ae83b6f76fc74 Krzysztof Kozlowski 2015-12-30 743 info->regs = &s2mps13_rtc_regs;
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 744 alarm_irq = S2MPS14_IRQ_RTCA0;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 745 break;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 746 case S5M8763X:
e349c910e2398c Krzysztof Kozlowski 2014-04-14 747 regmap_cfg = &s5m_rtc_regmap_config;
f8b23bbdad5dfb Krzysztof Kozlowski 2014-06-10 748 info->regs = &s5m_rtc_regs;
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 749 alarm_irq = S5M8763_IRQ_ALARM0;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 750 break;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 751 case S5M8767X:
e349c910e2398c Krzysztof Kozlowski 2014-04-14 752 regmap_cfg = &s5m_rtc_regmap_config;
f8b23bbdad5dfb Krzysztof Kozlowski 2014-06-10 753 info->regs = &s5m_rtc_regs;
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 754 alarm_irq = S5M8767_IRQ_RTCA1;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 755 break;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 756 default:
94f919225890a1 Krzysztof Kozlowski 2015-04-16 757 dev_err(&pdev->dev,
94f919225890a1 Krzysztof Kozlowski 2015-04-16 758 "Device type %lu is not supported by RTC driver\n",
94f919225890a1 Krzysztof Kozlowski 2015-04-16 759 platform_get_device_id(pdev)->driver_data);
e349c910e2398c Krzysztof Kozlowski 2014-04-14 760 return -ENODEV;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 761 }
e349c910e2398c Krzysztof Kozlowski 2014-04-14 762
21651184178d10 Bartosz Golaszewski 2021-01-05 763 info->i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter,
21651184178d10 Bartosz Golaszewski 2021-01-05 764 RTC_I2C_ADDR);
aae364d2a88897 Wolfram Sang 2019-07-22 765 if (IS_ERR(info->i2c)) {
e349c910e2398c Krzysztof Kozlowski 2014-04-14 766 dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n");
aae364d2a88897 Wolfram Sang 2019-07-22 767 return PTR_ERR(info->i2c);
e349c910e2398c Krzysztof Kozlowski 2014-04-14 768 }
e349c910e2398c Krzysztof Kozlowski 2014-04-14 769
e349c910e2398c Krzysztof Kozlowski 2014-04-14 770 info->regmap = devm_regmap_init_i2c(info->i2c, regmap_cfg);
e349c910e2398c Krzysztof Kozlowski 2014-04-14 771 if (IS_ERR(info->regmap)) {
e349c910e2398c Krzysztof Kozlowski 2014-04-14 772 dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n",
e349c910e2398c Krzysztof Kozlowski 2014-04-14 @773 ret);
21651184178d10 Bartosz Golaszewski 2021-01-05 774 return PTR_ERR(info->regmap);
e349c910e2398c Krzysztof Kozlowski 2014-04-14 775 }
e349c910e2398c Krzysztof Kozlowski 2014-04-14 776
5bccae6ec45870 Sangbeom Kim 2013-11-12 777 info->dev = &pdev->dev;
5bccae6ec45870 Sangbeom Kim 2013-11-12 778 info->s5m87xx = s5m87xx;
94f919225890a1 Krzysztof Kozlowski 2015-04-16 779 info->device_type = platform_get_device_id(pdev)->driver_data;
5bccae6ec45870 Sangbeom Kim 2013-11-12 780
b7d5b9a9686674 Bartlomiej Zolnierkiewicz 2014-08-29 781 if (s5m87xx->irq_data) {
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 782 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 783 if (info->irq <= 0) {
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 784 dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
a0347f20aaacc9 Krzysztof Kozlowski 2014-06-10 785 alarm_irq);
21651184178d10 Bartosz Golaszewski 2021-01-05 786 return -EINVAL;
5bccae6ec45870 Sangbeom Kim 2013-11-12 787 }
b7d5b9a9686674 Bartlomiej Zolnierkiewicz 2014-08-29 788 }
5bccae6ec45870 Sangbeom Kim 2013-11-12 789
5bccae6ec45870 Sangbeom Kim 2013-11-12 790 platform_set_drvdata(pdev, info);
5bccae6ec45870 Sangbeom Kim 2013-11-12 791
5bccae6ec45870 Sangbeom Kim 2013-11-12 792 ret = s5m8767_rtc_init_reg(info);
5bccae6ec45870 Sangbeom Kim 2013-11-12 793
5bccae6ec45870 Sangbeom Kim 2013-11-12 794 device_init_wakeup(&pdev->dev, 1);
5bccae6ec45870 Sangbeom Kim 2013-11-12 795
5bccae6ec45870 Sangbeom Kim 2013-11-12 796 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc",
5bccae6ec45870 Sangbeom Kim 2013-11-12 797 &s5m_rtc_ops, THIS_MODULE);
5bccae6ec45870 Sangbeom Kim 2013-11-12 798
21651184178d10 Bartosz Golaszewski 2021-01-05 799 if (IS_ERR(info->rtc_dev))
21651184178d10 Bartosz Golaszewski 2021-01-05 800 return PTR_ERR(info->rtc_dev);
5bccae6ec45870 Sangbeom Kim 2013-11-12 801
b7d5b9a9686674 Bartlomiej Zolnierkiewicz 2014-08-29 802 if (!info->irq) {
b7d5b9a9686674 Bartlomiej Zolnierkiewicz 2014-08-29 803 dev_info(&pdev->dev, "Alarm IRQ not available\n");
b7d5b9a9686674 Bartlomiej Zolnierkiewicz 2014-08-29 804 return 0;
b7d5b9a9686674 Bartlomiej Zolnierkiewicz 2014-08-29 805 }
b7d5b9a9686674 Bartlomiej Zolnierkiewicz 2014-08-29 806
5bccae6ec45870 Sangbeom Kim 2013-11-12 807 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
5bccae6ec45870 Sangbeom Kim 2013-11-12 808 s5m_rtc_alarm_irq, 0, "rtc-alarm0",
5bccae6ec45870 Sangbeom Kim 2013-11-12 809 info);
e349c910e2398c Krzysztof Kozlowski 2014-04-14 810 if (ret < 0) {
5bccae6ec45870 Sangbeom Kim 2013-11-12 811 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
5bccae6ec45870 Sangbeom Kim 2013-11-12 812 info->irq, ret);
21651184178d10 Bartosz Golaszewski 2021-01-05 813 return ret;
e349c910e2398c Krzysztof Kozlowski 2014-04-14 814 }
e349c910e2398c Krzysztof Kozlowski 2014-04-14 815
e349c910e2398c Krzysztof Kozlowski 2014-04-14 816 return 0;
5bccae6ec45870 Sangbeom Kim 2013-11-12 817 }
5bccae6ec45870 Sangbeom Kim 2013-11-12 818

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip