"-Werror=tautological-compare" error while building kernel 4.9

I have downloaded the Nvidia kernel sources and unpacked to the directory /usr/src/Linux_for_Tegra/source/public/kernel/kernel-4.9. I called make modules and after some time I get the error message -Werror=tautological-compare:

  CC [M]  drivers/net/wireless/realtek/rtl8812au/hal/rtl8812a/usb/rtl8812au_xmit.o
/usr/src/Linux_for_Tegra/source/public/kernel/nvidia/drivers/net/wireless/realtek/rtl8812au/hal/rtl8812a/usb/rtl8812au_xmit.c: In function ‘upload_txpktbuf_8812au’:
/usr/src/Linux_for_Tegra/source/public/kernel/nvidia/drivers/net/wireless/realtek/rtl8812au/hal/rtl8812a/usb/rtl8812au_xmit.c:433:61: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  433 |   while ((rtw_read32(adapter, REG_PKTBUF_DBG_CTRL) & BIT23) == 1) {
      |                                                             ^~
cc1: all warnings being treated as errors

How can I solve / avoid this?

Please follow below document to build from host device.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html#

Thanks for your effort. I am aware of that document, but don’t see how it solves my specific issue. Could you please point me to the relevant section (from which you think it solves the issue) in that document?

Does the instruction to build kernel Image working for you? Why call make modules

Which is the instruction to build kernel image? (I am compiling natively on the Jetson)

Please compile from X86 ubuntu PC follow the instruction from document.

This is an obvious bug in this driver code. See this for a fix.

For native kernel building you may also see this.

Thank you @Honey_Patouceul for your hint. That fixed it.