[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202504201347.OiWigSUq-lkp@intel.com>
Date: Sun, 20 Apr 2025 13:17:29 +0800
From: kernel test robot <lkp@...el.com>
To: "Rafael V. Volkmer" <rafael.v.volkmer@...il.com>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
ukleinek@...nel.org
Subject: Re: [PATCH v2 1/1] pwm: tiehrpwm: ensures that state.enabled is
synchronized in .probe()
Hi Rafael,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.15-rc2 next-20250417]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rafael-V-Volkmer/pwm-tiehrpwm-ensures-that-state-enabled-is-synchronized-in-probe/20250420-075200
base: linus/master
patch link: https://lore.kernel.org/r/20250206031852.64853-1-rafael.v.volkmer%40gmail.com
patch subject: [PATCH v2 1/1] pwm: tiehrpwm: ensures that state.enabled is synchronized in .probe()
config: um-randconfig-002-20250420 (https://download.01.org/0day-ci/archive/20250420/202504201347.OiWigSUq-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250420/202504201347.OiWigSUq-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504201347.OiWigSUq-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/pwm/pwm-tiehrpwm.c:11:
In file included from include/linux/io.h:12:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:549:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
549 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:567:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
567 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/pwm/pwm-tiehrpwm.c:11:
In file included from include/linux/io.h:12:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:585:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/pwm/pwm-tiehrpwm.c:11:
In file included from include/linux/io.h:12:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:601:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
601 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:616:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
616 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:631:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
631 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:724:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
724 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:737:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
737 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:750:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
750 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:764:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
764 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:778:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
778 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:792:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
792 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
>> drivers/pwm/pwm-tiehrpwm.c:675:7: warning: variable 'tbclk_enabled' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
675 | if (ret) {
| ^~~
drivers/pwm/pwm-tiehrpwm.c:706:6: note: uninitialized use occurs here
706 | if (tbclk_enabled)
| ^~~~~~~~~~~~~
drivers/pwm/pwm-tiehrpwm.c:675:3: note: remove the 'if' if its condition is always false
675 | if (ret) {
| ^~~~~~~~~~
676 | dev_err_probe(&pdev->dev, ret, "clk_prepare_enable() failed");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
677 | goto err_pwmchip_remove;
| ~~~~~~~~~~~~~~~~~~~~~~~~
678 | }
| ~
drivers/pwm/pwm-tiehrpwm.c:629:20: note: initialize the variable 'tbclk_enabled' to silence this warning
629 | bool tbclk_enabled;
| ^
| = 0
13 warnings generated.
vim +675 drivers/pwm/pwm-tiehrpwm.c
621
622 static int ehrpwm_pwm_probe(struct platform_device *pdev)
623 {
624 struct device_node *np = pdev->dev.of_node;
625 struct ehrpwm_pwm_chip *pc;
626 struct pwm_state state;
627 struct pwm_chip *chip;
628 struct clk *clk;
629 bool tbclk_enabled;
630 int ret;
631
632 chip = devm_pwmchip_alloc(&pdev->dev, NUM_PWM_CHANNEL, sizeof(*pc));
633 if (IS_ERR(chip))
634 return PTR_ERR(chip);
635 pc = to_ehrpwm_pwm_chip(chip);
636
637 clk = devm_clk_get(&pdev->dev, "fck");
638 if (IS_ERR(clk)) {
639 if (of_device_is_compatible(np, "ti,am33xx-ecap")) {
640 dev_warn(&pdev->dev, "Binding is obsolete.\n");
641 clk = devm_clk_get(pdev->dev.parent, "fck");
642 }
643 }
644
645 if (IS_ERR(clk))
646 return dev_err_probe(&pdev->dev, PTR_ERR(clk), "Failed to get fck\n");
647
648 pc->clk_rate = clk_get_rate(clk);
649 if (!pc->clk_rate) {
650 dev_err(&pdev->dev, "failed to get clock rate\n");
651 return -EINVAL;
652 }
653
654 chip->ops = &ehrpwm_pwm_ops;
655
656 pc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
657 if (IS_ERR(pc->mmio_base))
658 return PTR_ERR(pc->mmio_base);
659
660 /* Acquire tbclk for Time Base EHRPWM submodule */
661 pc->tbclk = devm_clk_get(&pdev->dev, "tbclk");
662 if (IS_ERR(pc->tbclk))
663 return dev_err_probe(&pdev->dev, PTR_ERR(pc->tbclk), "Failed to get tbclk\n");
664
665 ret = clk_prepare(pc->tbclk);
666 if (ret < 0) {
667 dev_err(&pdev->dev, "clk_prepare() failed: %d\n", ret);
668 return ret;
669 }
670
671 ehrpwm_get_state(chip, &chip->pwms[0], &state);
672
673 if (state.enabled == true) {
674 ret = clk_prepare_enable(pc->tbclk);
> 675 if (ret) {
676 dev_err_probe(&pdev->dev, ret, "clk_prepare_enable() failed");
677 goto err_pwmchip_remove;
678 }
679
680 tbclk_enabled = true;
681 }
682
683 ret = pwmchip_add(chip);
684 if (ret < 0) {
685 dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
686 goto err_clk_unprepare;
687 }
688
689 platform_set_drvdata(pdev, chip);
690 pm_runtime_enable(&pdev->dev);
691
692 if (state.enabled == true) {
693 ret = pm_runtime_get_sync(&pdev->dev);
694 if (ret < 0) {
695 dev_err_probe(&pdev->dev, ret, "pm_runtime_get_sync() failed");
696 clk_disable_unprepare(pc->tbclk);
697 goto err_pwmchip_remove;
698 }
699 }
700
701 return 0;
702
703 err_pwmchip_remove:
704 pwmchip_remove(chip);
705 err_clk_unprepare:
706 if (tbclk_enabled)
707 clk_unprepare(pc->tbclk);
708
709 return ret;
710 }
711
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists