Re: [PATCH v20 2/2] wireless: Initial driver submission for pureLiFi STA devices

Kari Argillander
2021-10-25T09:59:37Z

On Mon, Oct 18, 2021 at 11:00:55AM +0100, Srinivasan Raju wrote:
> This driver implementation has been based on the zd1211rw driver
>
> Driver is based on 802.11 softMAC Architecture and uses
> native 802.11 for configuration and management
>
> The driver is compiled and tested in ARM, x86 architectures and
> compiled in powerpc architecture

I have run some static analyzing tools against this driver. Here is my
findings. If you have CI system in house I strongly recommend that you
take these in use. Note that I have included just what might be real
warnings but they might also not be. Please check them.

------------------------------------------
Thease are just what I found myself.

drivers/net/wireless/purelifi/plfxlc/usb.c:47:
Has static. Will not work with multiple device.

drivers/net/wireless/purelifi/plfxlc/mac.h:75: You use spaces over tabs.
drivers/net/wireless/purelifi/plfxlc/mac.c:704: You use spaces over tabs.
drivers/net/wireless/purelifi/plfxlc/usb.c:920: You use spaces over tabs.
There is more of these. Please find all of them.

------------------------------------------
$ cppcheck drivers/net/wireless/purelifi/plfxlc/*.[ch] --enable=all

drivers/net/wireless/purelifi/plfxlc/usb.c:55:31: style:
Boolean result is used in bitwise operation. Clarify expression with
parentheses. [clarifyCondition]

drivers/net/wireless/purelifi/plfxlc/mac.c:447:6: style:
Condition '!bad_frame' is always true [knownConditionTrueFalse]

drivers/net/wireless/purelifi/plfxlc/mac.c:572:16: style:
Variable 'changed_flags' is assigned a value that is never used.
[unreadVariable]
Please check next comment line 577. There you talk about use of
changed_flags but you never use it.

Unused functions. I do not have opinion if you should remove these or
not, but some times there is bug if some function is unused. Please at
least comment if these are not mistakes.

drivers/net/wireless/purelifi/plfxlc/usb.c:38:0: style: The function 'get_bcd_device' is never used. [unusedFunction]
drivers/net/wireless/purelifi/plfxlc/usb.c:398:0: style: The function 'purelifi_usb_tx' is never used. [unusedFunction]
drivers/net/wireless/purelifi/plfxlc/chip.h:64:0: style: The function 'purelifi_mc_clear' is never used. [unusedFunction]
drivers/net/wireless/purelifi/plfxlc/chip.c:75:0: style: The function 'purelifi_chip_disable_rxtx' is never used. [unusedFunction]
drivers/net/wireless/purelifi/plfxlc/chip.h:79:0: style: The function 'purelifi_mc_add_addr' is never used. [unusedFunction]
drivers/net/wireless/purelifi/plfxlc/mac.c:89:0: style: The function 'purelifi_mac_init_hw' is never used. [unusedFunction]

------------------------------------------
$ codespell drivers/net/wireless/purelifi/plfxlc/*.[ch]

mac.c:237: ocasions ==> occasions
------------------------------------------
$ ./scripts/checkpatch.pl --strict drivers/net/wireless/purelifi/plfxlc/*.[ch]
$ make coccicheck M=drivers/net/wireless/purelifi/plfxlc/
$ flawfinder drivers/net/wireless/purelifi/plfxlc/*.[ch]

$ touch drivers/net/wireless/purelifi/plfxlc/*.[ch]
$ make -j6 W=1

These were all good.
------------------------------------------
$ touch drivers/net/wireless/purelifi/plfxlc/*.[ch]
$ make -j6 CC=clang W=1 drivers/net/wireless/purelifi/plfxlc/

drivers/net/wireless/purelifi/plfxlc/usb.c:38:19: warning:
unused function 'get_bcd_device' [-Wunused-function]

drivers/net/wireless/purelifi/plfxlc/usb.c:55:7: warning:
logical not is only applied to the left hand side of this bitwise
operator [-Wlogical-not-parentheses]
------------------------------------------
$ ~/smatch/smatch_scripts/build_kernel_data.sh
$ ~/smatch/smatch_scripts/kchecker drivers/net/wireless/purelifi/plfxlc/

drivers/net/wireless/purelifi/plfxlc/usb.c:55
purelifi_send_packet_from_data_queue() warn: add some parenthesis here?

drivers/net/wireless/purelifi/plfxlc/mac.c:685
purelifi_get_et_strings() error: memcpy() '*et_strings' too small (32 vs 64)

Argillander