* [linux-next:master 5399/6030] drivers/spi/spi-mt65xx.c:242:10: warning: comparison of distinct pointer types ('typeof (hold) *' (aka 'unsigned short *') and 'typeof (65535) *' (aka 'int *'))
@ 2021-08-07 7:29 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-07 7:29 UTC (permalink / raw)
To: Mason Zhang
Cc: clang-built-linux, kbuild-all, Linux Memory Management List, Mark Brown
[-- Attachment #1: Type: text/plain, Size: 8539 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 7999516e20bd9bb5d1f7351cbd05ca529a3a8d60
commit: 04e6bb0d6bb127bac929fb35edd2dd01613c9520 [5399/6030] spi: modify set_cs_timing parameter
config: hexagon-randconfig-r016-20210804 (attached as .config)
compiler: clang version 12.0.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=04e6bb0d6bb127bac929fb35edd2dd01613c9520
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 04e6bb0d6bb127bac929fb35edd2dd01613c9520
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/spi/spi-mt65xx.c:242:10: warning: comparison of distinct pointer types ('typeof (hold) *' (aka 'unsigned short *') and 'typeof (65535) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
hold = min(hold, 0xffff);
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>> drivers/spi/spi-mt65xx.c:243:11: warning: comparison of distinct pointer types ('typeof (setup) *' (aka 'unsigned short *') and 'typeof (65535) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
setup = min(setup, 0xffff);
^~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
drivers/spi/spi-mt65xx.c:251:10: warning: comparison of distinct pointer types ('typeof (hold) *' (aka 'unsigned short *') and 'typeof (255) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
hold = min(hold, 0xff);
^~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
drivers/spi/spi-mt65xx.c:252:11: warning: comparison of distinct pointer types ('typeof (setup) *' (aka 'unsigned short *') and 'typeof (255) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
setup = min(setup, 0xff);
^~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>> drivers/spi/spi-mt65xx.c:261:13: warning: comparison of distinct pointer types ('typeof (inactive) *' (aka 'unsigned short *') and 'typeof (255) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
inactive = min(inactive, 0xff);
^~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
5 warnings generated.
vim +242 drivers/spi/spi-mt65xx.c
210
211 static int mtk_spi_set_hw_cs_timing(struct spi_device *spi)
212 {
213 struct mtk_spi *mdata = spi_master_get_devdata(spi->master);
214 struct spi_delay *cs_setup = &spi->cs_setup;
215 struct spi_delay *cs_hold = &spi->cs_hold;
216 struct spi_delay *cs_inactive = &spi->cs_inactive;
217 u16 setup, hold, inactive;
218 u32 reg_val;
219 int delay;
220
221 delay = spi_delay_to_ns(cs_setup, NULL);
222 if (delay < 0)
223 return delay;
224 setup = (delay * DIV_ROUND_UP(mdata->spi_clk_hz, 1000000)) / 1000;
225
226 delay = spi_delay_to_ns(cs_hold, NULL);
227 if (delay < 0)
228 return delay;
229 hold = (delay * DIV_ROUND_UP(mdata->spi_clk_hz, 1000000)) / 1000;
230
231 delay = spi_delay_to_ns(cs_inactive, NULL);
232 if (delay < 0)
233 return delay;
234 inactive = (delay * DIV_ROUND_UP(mdata->spi_clk_hz, 1000000)) / 1000;
235
236 setup = setup ? setup : 1;
237 hold = hold ? hold : 1;
238 inactive = inactive ? inactive : 1;
239
240 reg_val = readl(mdata->base + SPI_CFG0_REG);
241 if (mdata->dev_comp->enhance_timing) {
> 242 hold = min(hold, 0xffff);
> 243 setup = min(setup, 0xffff);
244 reg_val &= ~(0xffff << SPI_ADJUST_CFG0_CS_HOLD_OFFSET);
245 reg_val |= (((hold - 1) & 0xffff)
246 << SPI_ADJUST_CFG0_CS_HOLD_OFFSET);
247 reg_val &= ~(0xffff << SPI_ADJUST_CFG0_CS_SETUP_OFFSET);
248 reg_val |= (((setup - 1) & 0xffff)
249 << SPI_ADJUST_CFG0_CS_SETUP_OFFSET);
250 } else {
251 hold = min(hold, 0xff);
252 setup = min(setup, 0xff);
253 reg_val &= ~(0xff << SPI_CFG0_CS_HOLD_OFFSET);
254 reg_val |= (((hold - 1) & 0xff) << SPI_CFG0_CS_HOLD_OFFSET);
255 reg_val &= ~(0xff << SPI_CFG0_CS_SETUP_OFFSET);
256 reg_val |= (((setup - 1) & 0xff)
257 << SPI_CFG0_CS_SETUP_OFFSET);
258 }
259 writel(reg_val, mdata->base + SPI_CFG0_REG);
260
> 261 inactive = min(inactive, 0xff);
262 reg_val = readl(mdata->base + SPI_CFG1_REG);
263 reg_val &= ~SPI_CFG1_CS_IDLE_MASK;
264 reg_val |= (((inactive - 1) & 0xff) << SPI_CFG1_CS_IDLE_OFFSET);
265 writel(reg_val, mdata->base + SPI_CFG1_REG);
266
267 return 0;
268 }
269
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36643 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-07 7:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07 7:29 [linux-next:master 5399/6030] drivers/spi/spi-mt65xx.c:242:10: warning: comparison of distinct pointer types ('typeof (hold) *' (aka 'unsigned short *') and 'typeof (65535) *' (aka 'int *')) kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).