2023-04-29 16:53:48

by kernel test robot

[permalink] [raw]
Subject: drivers/bluetooth/btnxpuart.c:1277:34: warning: unused variable 'nxpuart_of_match_table'

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 89d77f71f493a3663b10fa812d17f472935d24be
commit: 689ca16e523278470c38832a3010645a78c544d8 Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets
date: 6 days ago
config: hexagon-randconfig-r045-20230428 (https://download.01.org/0day-ci/archive/20230430/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 437b7602e4a998220871de78afcb020b9c14a661)
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/torvalds/linux.git/commit/?id=689ca16e523278470c38832a3010645a78c544d8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 689ca16e523278470c38832a3010645a78c544d8
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/bluetooth/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from drivers/bluetooth/btnxpuart.c:10:
In file included from include/linux/serdev.h:10:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
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'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/bluetooth/btnxpuart.c:10:
In file included from include/linux/serdev.h:10:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
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'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/bluetooth/btnxpuart.c:10:
In file included from include/linux/serdev.h:10:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> drivers/bluetooth/btnxpuart.c:1277:34: warning: unused variable 'nxpuart_of_match_table' [-Wunused-const-variable]
static const struct of_device_id nxpuart_of_match_table[] = {
^
7 warnings generated.


vim +/nxpuart_of_match_table +1277 drivers/bluetooth/btnxpuart.c

1276
> 1277 static const struct of_device_id nxpuart_of_match_table[] = {
1278 { .compatible = "nxp,88w8987-bt", .data = &w8987_data },
1279 { .compatible = "nxp,88w8997-bt", .data = &w8997_data },
1280 { }
1281 };
1282 MODULE_DEVICE_TABLE(of, nxpuart_of_match_table);
1283

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


2023-05-18 06:48:40

by Neeraj Sanjay Kale

[permalink] [raw]
Subject: RE: [EXT] drivers/bluetooth/btnxpuart.c:1277:34: warning: unused variable 'nxpuart_of_match_table'

Hi Luiz,

Below warning is resolved with following code change:

diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 5f641466d695..fa6ac4dacd1d 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -1264,6 +1264,7 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
hci_free_dev(hdev);
}

+#ifdef CONFIG_OF
static struct btnxpuart_data w8987_data = {
.fw_download_3M_baudrate = true,
.fw_name = FIRMWARE_W8987,
@@ -1280,6 +1281,7 @@ static const struct of_device_id nxpuart_of_match_table[] = {
{ }
};
MODULE_DEVICE_TABLE(of, nxpuart_of_match_table);
+#endif

However, I was asked to remove this '#ifdef CONFIG_OF' in V2 patch by Rob, as this driver only supports DT.
https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/

Please let me know if I should add it back to resolve this warning.

Thanks,
Neeraj

> -----Original Message-----
> From: kernel test robot <[email protected]>
> Sent: Saturday, April 29, 2023 10:10 PM
> To: Neeraj sanjay kale <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; Luiz Augusto von Dentz <[email protected]>;
> Ilpo J?rvinen <[email protected]>
> Subject: [EXT] drivers/bluetooth/btnxpuart.c:1277:34: warning: unused
> variable 'nxpuart_of_match_table'
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> tree:
> https://git.ker/
> nel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git&da
> ta=05%7C01%7Cneeraj.sanjaykale%40nxp.com%7C11316289cf9545181d0108
> db48d0676b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638183
> 832151571141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdat
> a=4l684I87hYaEh5cUL%2Bq15Vded2F4OQ3DgIugH4zWUJw%3D&reserved=0
> master
> head: 89d77f71f493a3663b10fa812d17f472935d24be
> commit: 689ca16e523278470c38832a3010645a78c544d8 Bluetooth: NXP: Add
> protocol support for NXP Bluetooth chipsets
> date: 6 days ago
> config: hexagon-randconfig-r045-20230428
> (https://dow/
> nload.01.org%2F0day-
> ci%2Farchive%2F20230430%2F202304300014.vFGw6Dr0-
> lkp%40intel.com%2Fconfig&data=05%7C01%7Cneeraj.sanjaykale%40nxp.co
> m%7C11316289cf9545181d0108db48d0676b%7C686ea1d3bc2b4c6fa92cd99c
> 5c301635%7C0%7C0%7C638183832151571141%7CUnknown%7CTWFpbGZsb
> 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0
> %3D%7C3000%7C%7C%7C&sdata=eIEMVERAnzpSUne5cHVZ4E%2F4J%2BDI0
> yWQv0muvQCHGx4%3D&reserved=0)
> compiler: clang version 17.0.0
> (https://githu/
> b.com%2Fllvm%2Fllvm-
> project&data=05%7C01%7Cneeraj.sanjaykale%40nxp.com%7C11316289cf954
> 5181d0108db48d0676b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0
> %7C638183832151727365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj
> AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%
> 7C%7C&sdata=qPIgkv4%2FfQT%2FaNq5p9oGoU6bcdlA7Afgk5EcmmzAUDE%
> 3D&reserved=0 437b7602e4a998220871de78afcb020b9c14a661)
> reproduce (this is a W=1 build):
> wget
> https://raw.gi/
> thubusercontent.com%2Fintel%2Flkp-
> tests%2Fmaster%2Fsbin%2Fmake.cross&data=05%7C01%7Cneeraj.sanjaykal
> e%40nxp.com%7C11316289cf9545181d0108db48d0676b%7C686ea1d3bc2b4
> c6fa92cd99c5c301635%7C0%7C0%7C638183832151727365%7CUnknown%7C
> TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiL
> CJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Ob0AKmINs53NPoF%2B6MI4
> %2Bco1dbRThKLdfqWeon%2F5G%2Bs%3D&reserved=0 -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> #
> https://git.ker/
> nel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2F
> commit%2F%3Fid%3D689ca16e523278470c38832a3010645a78c544d8&data=
> 05%7C01%7Cneeraj.sanjaykale%40nxp.com%7C11316289cf9545181d0108db
> 48d0676b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63818383
> 2151727365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIj
> oiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=
> Gr95jXMcCmzeEhCJbbUaz05ng1APFM3Go0CtIK6VLdk%3D&reserved=0
> git remote add linus
> https://git.ker/
> nel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git&da
> ta=05%7C01%7Cneeraj.sanjaykale%40nxp.com%7C11316289cf9545181d0108
> db48d0676b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638183
> 832151727365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdat
> a=GqQ70C15HhFspSctvuCHHbJliFN2mv94%2Faw%2BrBjUlB4%3D&reserved=
> 0
> git fetch --no-tags linus master
> git checkout 689ca16e523278470c38832a3010645a78c544d8
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross
> W=1 O=build_dir ARCH=hexagon olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross
> W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/bluetooth/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <[email protected]>
> | Link:
> https://lore.k/
> ernel.org%2Foe-kbuild-all%2F202304300014.vFGw6Dr0-
> lkp%40intel.com%2F&data=05%7C01%7Cneeraj.sanjaykale%40nxp.com%7C1
> 1316289cf9545181d0108db48d0676b%7C686ea1d3bc2b4c6fa92cd99c5c3016
> 35%7C0%7C0%7C638183832151727365%7CUnknown%7CTWFpbGZsb3d8eyJ
> WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
> 7C3000%7C%7C%7C&sdata=fuRUTaxTT04M2tT6SUVJDRWbTo3lAkdxgSTk4ov
> enh8%3D&reserved=0
>
> All warnings (new ones prefixed by >>):
>
> In file included from drivers/bluetooth/btnxpuart.c:10:
> In file included from include/linux/serdev.h:10:
> In file included from include/linux/iopoll.h:14:
> In file included from include/linux/io.h:13:
> In file included from arch/hexagon/include/asm/io.h:334:
> include/asm-generic/io.h:547:31: warning: performing pointer arithmetic
> on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> val = __raw_readb(PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:560:61: warning: performing pointer arithmetic
> on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 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'
> #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
> ^
> In file included from drivers/bluetooth/btnxpuart.c:10:
> In file included from include/linux/serdev.h:10:
> In file included from include/linux/iopoll.h:14:
> In file included from include/linux/io.h:13:
> In file included from arch/hexagon/include/asm/io.h:334:
> include/asm-generic/io.h:573:61: warning: performing pointer arithmetic
> on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> 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'
> #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
> ^
> In file included from drivers/bluetooth/btnxpuart.c:10:
> In file included from include/linux/serdev.h:10:
> In file included from include/linux/iopoll.h:14:
> In file included from include/linux/io.h:13:
> In file included from arch/hexagon/include/asm/io.h:334:
> include/asm-generic/io.h:584:33: warning: performing pointer arithmetic
> on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writeb(value, PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:594:59: warning: performing pointer arithmetic
> on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> include/asm-generic/io.h:604:59: warning: performing pointer arithmetic
> on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
> __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
> ~~~~~~~~~~ ^
> >> drivers/bluetooth/btnxpuart.c:1277:34: warning: unused variable
> 'nxpuart_of_match_table' [-Wunused-const-variable]
> static const struct of_device_id nxpuart_of_match_table[] = {
> ^
> 7 warnings generated.
>
>
> vim +/nxpuart_of_match_table +1277 drivers/bluetooth/btnxpuart.c
>
> 1276
> > 1277 static const struct of_device_id nxpuart_of_match_table[] = {
> 1278 { .compatible = "nxp,88w8987-bt", .data = &w8987_data },
> 1279 { .compatible = "nxp,88w8997-bt", .data = &w8997_data },
> 1280 { }
> 1281 };
> 1282 MODULE_DEVICE_TABLE(of, nxpuart_of_match_table);
> 1283
>
> --
> 0-DAY CI Kernel Test Service
> https://github/
> .com%2Fintel%2Flkp-
> tests&data=05%7C01%7Cneeraj.sanjaykale%40nxp.com%7C11316289cf9545
> 181d0108db48d0676b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%
> 7C638183832151727365%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
> wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7
> C%7C&sdata=kT8SZ3zL7FhnwCwY3eSxuj8y0uZCJx4RpYjGSPBL%2BjE%3D&res
> erved=0