[PATCH] mmc: mtk-sd: Improve data type in msdc_timeout_cal()
kernel test robot
lkp at intel.com
Sat Aug 17 04:36:32 PDT 2024
Hi Thorsten,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.11-rc3 next-20240816]
[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/Thorsten-Blum/mmc-mtk-sd-Improve-data-type-in-msdc_timeout_cal/20240816-102400
base: linus/master
patch link: https://lore.kernel.org/r/20240815234602.59684-1-thorsten.blum%40toblux.com
patch subject: [PATCH] mmc: mtk-sd: Improve data type in msdc_timeout_cal()
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240817/202408171942.A1TKwW7h-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 26670e7fa4f032a019d23d56c6a02926e854e8af)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240817/202408171942.A1TKwW7h-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408171942.A1TKwW7h-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
In file included from drivers/mmc/host/mtk-sd.c:11:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2228:
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
In file included from drivers/mmc/host/mtk-sd.c:11:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | 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/mmc/host/mtk-sd.c:11:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | 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/mmc/host/mtk-sd.c:11:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> drivers/mmc/host/mtk-sd.c:805:3: warning: comparison of distinct pointer types ('typeof ((clk_ns)) *' (aka 'unsigned int *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
805 | do_div(clk_ns, mmc->actual_clock);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:222:28: note: expanded from macro 'do_div'
222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
| ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>> drivers/mmc/host/mtk-sd.c:805:3: error: incompatible pointer types passing 'u32 *' (aka 'unsigned int *') to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
805 | do_div(clk_ns, mmc->actual_clock);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:238:22: note: expanded from macro 'do_div'
238 | __rem = __div64_32(&(n), __base); \
| ^~~~
include/asm-generic/div64.h:213:38: note: passing argument to parameter 'dividend' here
213 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
| ^
>> drivers/mmc/host/mtk-sd.c:805:3: warning: shift count >= width of type [-Wshift-count-overflow]
805 | do_div(clk_ns, mmc->actual_clock);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:234:25: note: expanded from macro 'do_div'
234 | } else if (likely(((n) >> 32) == 0)) { \
| ^ ~~
include/linux/compiler.h:76:40: note: expanded from macro 'likely'
76 | # define likely(x) __builtin_expect(!!(x), 1)
| ^
9 warnings and 1 error generated.
vim +805 drivers/mmc/host/mtk-sd.c
208489032bdd8d Chaotian Jing 2015-06-15 794
557011b6b8c87c Chun-Hung Wu 2020-07-20 795 static u64 msdc_timeout_cal(struct msdc_host *host, u64 ns, u64 clks)
208489032bdd8d Chaotian Jing 2015-06-15 796 {
0caf60c4b110b5 Amey Narkhede 2020-09-18 797 struct mmc_host *mmc = mmc_from_priv(host);
d5c9ac0e2eb203 Thorsten Blum 2024-08-16 798 u64 timeout;
d5c9ac0e2eb203 Thorsten Blum 2024-08-16 799 u32 clk_ns, mode = 0;
208489032bdd8d Chaotian Jing 2015-06-15 800
0caf60c4b110b5 Amey Narkhede 2020-09-18 801 if (mmc->actual_clock == 0) {
208489032bdd8d Chaotian Jing 2015-06-15 802 timeout = 0;
208489032bdd8d Chaotian Jing 2015-06-15 803 } else {
d5c9ac0e2eb203 Thorsten Blum 2024-08-16 804 clk_ns = 1000000000U;
0caf60c4b110b5 Amey Narkhede 2020-09-18 @805 do_div(clk_ns, mmc->actual_clock);
557011b6b8c87c Chun-Hung Wu 2020-07-20 806 timeout = ns + clk_ns - 1;
557011b6b8c87c Chun-Hung Wu 2020-07-20 807 do_div(timeout, clk_ns);
557011b6b8c87c Chun-Hung Wu 2020-07-20 808 timeout += clks;
208489032bdd8d Chaotian Jing 2015-06-15 809 /* in 1048576 sclk cycle unit */
4fe54318496004 AngeloGioacchino Del Regno 2021-12-16 810 timeout = DIV_ROUND_UP(timeout, BIT(20));
762d491a8bff7a Chaotian Jing 2017-10-16 811 if (host->dev_comp->clk_div_bits == 8)
762d491a8bff7a Chaotian Jing 2017-10-16 812 sdr_get_field(host->base + MSDC_CFG,
762d491a8bff7a Chaotian Jing 2017-10-16 813 MSDC_CFG_CKMOD, &mode);
762d491a8bff7a Chaotian Jing 2017-10-16 814 else
762d491a8bff7a Chaotian Jing 2017-10-16 815 sdr_get_field(host->base + MSDC_CFG,
762d491a8bff7a Chaotian Jing 2017-10-16 816 MSDC_CFG_CKMOD_EXTRA, &mode);
208489032bdd8d Chaotian Jing 2015-06-15 817 /*DDR mode will double the clk cycles for data timeout */
208489032bdd8d Chaotian Jing 2015-06-15 818 timeout = mode >= 2 ? timeout * 2 : timeout;
208489032bdd8d Chaotian Jing 2015-06-15 819 timeout = timeout > 1 ? timeout - 1 : 0;
208489032bdd8d Chaotian Jing 2015-06-15 820 }
557011b6b8c87c Chun-Hung Wu 2020-07-20 821 return timeout;
557011b6b8c87c Chun-Hung Wu 2020-07-20 822 }
557011b6b8c87c Chun-Hung Wu 2020-07-20 823
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the Linux-mediatek
mailing list