001-Fix-compilation-warning-with-64-bit-system.patch 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. From ed4422e98ababf956674da3438ac42b3aa32c66e Mon Sep 17 00:00:00 2001
  2. From: Christian Marangi <[email protected]>
  3. Date: Wed, 10 May 2023 00:41:06 +0200
  4. Subject: [PATCH] Fix compilation warning with 64 bit system
  5. Use %zu and %zd where possible for ssize_t and size_t.
  6. Use PTR_ERR to correctly convert to negative error.
  7. Use universal pointer to support both 32 and 64bit systems.
  8. Fix compilation warning:
  9. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/fwcmd.c: In function 'mwl_fwcmd_get_fw_core_dump':
  10. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/fwcmd.c:3608:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  11. 3608 | (const void *)((u32)pcmd +
  12. | ^
  13. In file included from ./include/linux/device.h:15,
  14. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/device.h:3,
  15. from ./include/linux/dma-mapping.h:7,
  16. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/dma-mapping.h:3,
  17. from ./include/linux/skbuff.h:31,
  18. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/skbuff.h:3,
  19. from ./include/linux/if_ether.h:19,
  20. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/if_ether.h:3,
  21. from ./include/linux/etherdevice.h:20,
  22. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/etherdevice.h:3,
  23. from /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:20:
  24. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c: In function 'pcie_tx_init_ndp':
  25. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:38: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=]
  26. 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
  27. | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28. ./include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
  29. 110 | _p_func(dev, fmt, ##__VA_ARGS__); \
  30. | ^~~
  31. ./include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
  32. 144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
  33. | ^~~~~~~
  34. /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211/net/cfg80211.h:8828:9: note: in expansion of macro 'dev_err'
  35. 8828 | dev_err(&(wiphy)->dev, format, ##args)
  36. | ^~~~~~~
  37. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:17: note: in expansion of macro 'wiphy_err'
  38. 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
  39. | ^~~~~~~~~
  40. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:67: note: format string is defined here
  41. 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
  42. | ~^
  43. | |
  44. | int
  45. | %ld
  46. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:38: error: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Werror=format=]
  47. 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
  48. | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. ./include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
  50. 110 | _p_func(dev, fmt, ##__VA_ARGS__); \
  51. | ^~~
  52. ./include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
  53. 144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
  54. | ^~~~~~~
  55. /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211/net/cfg80211.h:8828:9: note: in expansion of macro 'dev_err'
  56. 8828 | dev_err(&(wiphy)->dev, format, ##args)
  57. | ^~~~~~~
  58. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:17: note: in expansion of macro 'wiphy_err'
  59. 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
  60. | ^~~~~~~~~
  61. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:71: note: format string is defined here
  62. 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
  63. | ~^
  64. | |
  65. | int
  66. | %ld
  67. CC [M] /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/debugfs.o
  68. In file included from ./include/linux/device.h:15,
  69. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/device.h:3,
  70. from ./include/linux/dma-mapping.h:7,
  71. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/dma-mapping.h:3,
  72. from ./include/linux/skbuff.h:31,
  73. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/skbuff.h:3,
  74. from ./include/linux/if_ether.h:19,
  75. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/if_ether.h:3,
  76. from ./include/linux/etherdevice.h:20,
  77. from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/etherdevice.h:3,
  78. from /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c:19:
  79. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c: In function 'pcie_bf_mimo_ctrl_decode':
  80. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c:1325:37: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  81. 1325 | filename, (unsigned int)fp_data);
  82. | ^
  83. ./include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_printk_index_wrap'
  84. 110 | _p_func(dev, fmt, ##__VA_ARGS__); \
  85. | ^~~~~~~~~~~
  86. /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211/net/cfg80211.h:8828:9: note: in expansion of macro 'dev_err'
  87. 8828 | dev_err(&(wiphy)->dev, format, ##args)
  88. | ^~~~~~~
  89. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c:1324:17: note: in expansion of macro 'wiphy_err'
  90. 1324 | wiphy_err(priv->hw->wiphy, "Error opening %s! %x\n",
  91. | ^~~~~~~~~
  92. cc1: all warnings being treated as errors
  93. make[4]: *** [scripts/Makefile.build:289: /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.o] Error 1
  94. make[4]: *** Waiting for unfinished jobs....
  95. cc1: all warnings being treated as errors
  96. make[4]: *** [scripts/Makefile.build:289: /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.o] Error 1
  97. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/debugfs.c: In function 'mwl_debugfs_regrdwr_read':
  98. /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/debugfs.c:1335:43: error: format '%d' expects argument of type 'int', but argument 4 has type 'ssize_t' {aka 'long int'} [-Werror=format=]
  99. 1335 | "error: %d(%u 0x%08x 0x%08x)\n",
  100. | ~^
  101. | |
  102. | int
  103. | %ld
  104. 1336 | ret, priv->reg_type, priv->reg_offset,
  105. | ~~~
  106. | |
  107. | ssize_t {aka long int}
  108. cc1: all warnings being treated as errors
  109. Signed-off-by: Christian Marangi <[email protected]>
  110. ---
  111. debugfs.c | 2 +-
  112. hif/fwcmd.c | 2 +-
  113. hif/pcie/8964/tx_ndp.c | 2 +-
  114. hif/pcie/pcie.c | 4 ++--
  115. 4 files changed, 5 insertions(+), 5 deletions(-)
  116. --- a/debugfs.c
  117. +++ b/debugfs.c
  118. @@ -1342,7 +1342,7 @@ done:
  119. priv->reg_value);
  120. else
  121. len += scnprintf(p + len, size - len,
  122. - "error: %d(%u 0x%08x 0x%08x)\n",
  123. + "error: %zd(%u 0x%08x 0x%08x)\n",
  124. ret, priv->reg_type, priv->reg_offset,
  125. priv->reg_value);
  126. --- a/hif/fwcmd.c
  127. +++ b/hif/fwcmd.c
  128. @@ -3623,7 +3623,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ie
  129. core_dump->size_kb = pcmd->cmd_data.coredump.size_kb;
  130. core_dump->flags = pcmd->cmd_data.coredump.flags;
  131. memcpy(buff,
  132. - (const void *)((u32)pcmd +
  133. + (const void *)((uintptr_t)pcmd +
  134. sizeof(struct hostcmd_cmd_get_fw_core_dump) -
  135. sizeof(struct hostcmd_cmd_get_fw_core_dump_)),
  136. MAX_CORE_DUMP_BUFFER);
  137. --- a/hif/pcie/8964/tx_ndp.c
  138. +++ b/hif/pcie/8964/tx_ndp.c
  139. @@ -336,7 +336,7 @@ int pcie_tx_init_ndp(struct ieee80211_hw
  140. if (sizeof(struct pcie_tx_ctrl_ndp) >
  141. sizeof(tx_info->driver_data)) {
  142. - wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
  143. + wiphy_err(hw->wiphy, "driver data is not enough: %zu (%zu)\n",
  144. sizeof(struct pcie_tx_ctrl_ndp),
  145. sizeof(tx_info->driver_data));
  146. return -ENOMEM;
  147. --- a/hif/pcie/pcie.c
  148. +++ b/hif/pcie/pcie.c
  149. @@ -1466,8 +1466,8 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv,
  150. &fp_data->f_pos);
  151. filp_close(fp_data, current->files);
  152. } else {
  153. - wiphy_err(priv->hw->wiphy, "Error opening %s! %x\n",
  154. - filename, (unsigned int)fp_data);
  155. + wiphy_err(priv->hw->wiphy, "Error opening %s! %ld\n",
  156. + filename, PTR_ERR(fp_data));
  157. }
  158. #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)