All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
Date: Tue, 23 Jun 2020 13:56:38 +0800	[thread overview]
Message-ID: <202006231335.urptDQAp%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 8507 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dd0d718152e4c65b173070d48ea9dfc06894c3e5
commit: 652b4afb240e5dc196995597942309e89e89c767 staging: wfx: load firmware
date:   9 months ago
config: xtensa-randconfig-m031-20200623 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0

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/staging/wfx/fwio.c:83:5: warning: no previous prototype for 'sram_write_dma_safe' [-Wmissing-prototypes]
      83 | int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len)
         |     ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/firmware.h:6,
                    from drivers/staging/wfx/fwio.c:8:
   drivers/staging/wfx/fwio.c: In function 'sram_write_dma_safe':
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
>> drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
      88 |  if (!virt_addr_valid(buf)) {
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:88:7: note: in expansion of macro 'virt_addr_valid'
      88 |  if (!virt_addr_valid(buf)) {
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
>> drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
      88 |  if (!virt_addr_valid(buf)) {
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:88:7: note: in expansion of macro 'virt_addr_valid'
      88 |  if (!virt_addr_valid(buf)) {
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
>> drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
      88 |  if (!virt_addr_valid(buf)) {
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:88:7: note: in expansion of macro 'virt_addr_valid'
      88 |  if (!virt_addr_valid(buf)) {
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   drivers/staging/wfx/fwio.c:96:2: note: in expansion of macro 'if'
      96 |  if (!virt_addr_valid(buf))
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:96:7: note: in expansion of macro 'virt_addr_valid'
      96 |  if (!virt_addr_valid(buf))
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
   drivers/staging/wfx/fwio.c:96:2: note: in expansion of macro 'if'
      96 |  if (!virt_addr_valid(buf))
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:96:7: note: in expansion of macro 'virt_addr_valid'
      96 |  if (!virt_addr_valid(buf))
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/staging/wfx/fwio.c:96:2: note: in expansion of macro 'if'
      96 |  if (!virt_addr_valid(buf))
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:96:7: note: in expansion of macro 'virt_addr_valid'
      96 |  if (!virt_addr_valid(buf))
         |       ^~~~~~~~~~~~~~~
   drivers/staging/wfx/fwio.c: At top level:
   drivers/staging/wfx/fwio.c:101:5: warning: no previous prototype for 'get_firmware' [-Wmissing-prototypes]
     101 | int get_firmware(struct wfx_dev *wdev, u32 keyset_chip,
         |     ^~~~~~~~~~~~
   drivers/staging/wfx/fwio.c:229:5: warning: no previous prototype for 'load_firmware_secure' [-Wmissing-prototypes]
     229 | int load_firmware_secure(struct wfx_dev *wdev)
         |     ^~~~~~~~~~~~~~~~~~~~

vim +/if +88 drivers/staging/wfx/fwio.c

    71	
    72	/*
    73	 * request_firmware() allocate data using vmalloc(). It is not compatible with
    74	 * underlying hardware that use DMA. Function below detect this case and
    75	 * allocate a bounce buffer if necessary.
    76	 *
    77	 * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to
    78	 * detect this problem at runtime  (else, kernel silently fail).
    79	 *
    80	 * NOTE: it may also be possible to use 'pages' from struct firmware and avoid
    81	 * bounce buffer
    82	 */
    83	int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len)
    84	{
    85		int ret;
    86		const u8 *tmp;
    87	
  > 88		if (!virt_addr_valid(buf)) {
    89			tmp = kmemdup(buf, len, GFP_KERNEL);
    90			if (!tmp)
    91				return -ENOMEM;
    92		} else {
    93			tmp = buf;
    94		}
    95		ret = sram_buf_write(wdev, addr, tmp, len);
    96		if (!virt_addr_valid(buf))
    97			kfree(tmp);
    98		return ret;
    99	}
   100	

---
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: 29911 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
Date: Tue, 23 Jun 2020 13:56:38 +0800	[thread overview]
Message-ID: <202006231335.urptDQAp%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 8667 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dd0d718152e4c65b173070d48ea9dfc06894c3e5
commit: 652b4afb240e5dc196995597942309e89e89c767 staging: wfx: load firmware
date:   9 months ago
config: xtensa-randconfig-m031-20200623 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0

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/staging/wfx/fwio.c:83:5: warning: no previous prototype for 'sram_write_dma_safe' [-Wmissing-prototypes]
      83 | int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len)
         |     ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/firmware.h:6,
                    from drivers/staging/wfx/fwio.c:8:
   drivers/staging/wfx/fwio.c: In function 'sram_write_dma_safe':
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
>> drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
      88 |  if (!virt_addr_valid(buf)) {
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:88:7: note: in expansion of macro 'virt_addr_valid'
      88 |  if (!virt_addr_valid(buf)) {
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
>> drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
      88 |  if (!virt_addr_valid(buf)) {
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:88:7: note: in expansion of macro 'virt_addr_valid'
      88 |  if (!virt_addr_valid(buf)) {
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
>> drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if'
      88 |  if (!virt_addr_valid(buf)) {
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:88:7: note: in expansion of macro 'virt_addr_valid'
      88 |  if (!virt_addr_valid(buf)) {
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   drivers/staging/wfx/fwio.c:96:2: note: in expansion of macro 'if'
      96 |  if (!virt_addr_valid(buf))
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:96:7: note: in expansion of macro 'virt_addr_valid'
      96 |  if (!virt_addr_valid(buf))
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
   drivers/staging/wfx/fwio.c:96:2: note: in expansion of macro 'if'
      96 |  if (!virt_addr_valid(buf))
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:96:7: note: in expansion of macro 'virt_addr_valid'
      96 |  if (!virt_addr_valid(buf))
         |       ^~~~~~~~~~~~~~~
   arch/xtensa/include/asm/page.h:182:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     182 |  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |         ^~
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/staging/wfx/fwio.c:96:2: note: in expansion of macro 'if'
      96 |  if (!virt_addr_valid(buf))
         |  ^~
   arch/xtensa/include/asm/page.h:190:32: note: in expansion of macro 'pfn_valid'
     190 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
         |                                ^~~~~~~~~
   drivers/staging/wfx/fwio.c:96:7: note: in expansion of macro 'virt_addr_valid'
      96 |  if (!virt_addr_valid(buf))
         |       ^~~~~~~~~~~~~~~
   drivers/staging/wfx/fwio.c: At top level:
   drivers/staging/wfx/fwio.c:101:5: warning: no previous prototype for 'get_firmware' [-Wmissing-prototypes]
     101 | int get_firmware(struct wfx_dev *wdev, u32 keyset_chip,
         |     ^~~~~~~~~~~~
   drivers/staging/wfx/fwio.c:229:5: warning: no previous prototype for 'load_firmware_secure' [-Wmissing-prototypes]
     229 | int load_firmware_secure(struct wfx_dev *wdev)
         |     ^~~~~~~~~~~~~~~~~~~~

vim +/if +88 drivers/staging/wfx/fwio.c

    71	
    72	/*
    73	 * request_firmware() allocate data using vmalloc(). It is not compatible with
    74	 * underlying hardware that use DMA. Function below detect this case and
    75	 * allocate a bounce buffer if necessary.
    76	 *
    77	 * Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to
    78	 * detect this problem at runtime  (else, kernel silently fail).
    79	 *
    80	 * NOTE: it may also be possible to use 'pages' from struct firmware and avoid
    81	 * bounce buffer
    82	 */
    83	int sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len)
    84	{
    85		int ret;
    86		const u8 *tmp;
    87	
  > 88		if (!virt_addr_valid(buf)) {
    89			tmp = kmemdup(buf, len, GFP_KERNEL);
    90			if (!tmp)
    91				return -ENOMEM;
    92		} else {
    93			tmp = buf;
    94		}
    95		ret = sram_buf_write(wdev, addr, tmp, len);
    96		if (!virt_addr_valid(buf))
    97			kfree(tmp);
    98		return ret;
    99	}
   100	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29911 bytes --]

             reply	other threads:[~2020-06-23  5:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23  5:56 kernel test robot [this message]
2020-06-23  5:56 ` drivers/staging/wfx/fwio.c:88:2: note: in expansion of macro 'if' kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202006231335.urptDQAp%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jerome.pouiller@silabs.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.