How to use sparse to check my driver

wangyubin 64903517 at qq.com
Wed Mar 12 05:39:10 EDT 2014


Hi, silverstri

> how does it actually call 'spare'? Do I need to modify my Makefile to
> add a new target or something?
If you called 'make C=2 ... ', the make will auto call sparse to check 
the source.
Obviously, you should install sparse first.

If you do the 'make C=2 drivers/staging/wlan-ng/', and don't get the 
check results,
I think maybe the 'wlan-ng' doesn't include in your built target.

Please use 'make menuconfig' to add the target wlan-ng.
1. make menuconfig
2. select 'Device Drivers -->'
3. select 'Staging drivers -->'
4. select 'Prism2.5/3 USB driver' like this ' <M> Prism2.5/3 USB driver'
5. exit the menuconfig
6. make C=2 drivers/staging/wlan-ng/ then you will get the check result.

I had test it on kernel v2.6.32.61, and got the messages below:
================================================
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CALL scripts/checksyscalls.sh
CHECK scripts/mod/empty.c
CHECK drivers/staging/wlan-ng/prism2usb.c
drivers/staging/wlan-ng/hfa384x_usb.c:2810:62: warning: dubious: !x | !y
drivers/staging/wlan-ng/prism2fw.c:124:14: warning: symbol 'ns3data' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:125:13: warning: symbol 's3data' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:128:14: warning: symbol 'ns3plug' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:129:13: warning: symbol 's3plug' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:132:14: warning: symbol 'ns3crc' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:133:12: warning: symbol 's3crc' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:136:14: warning: symbol 'ns3info' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:137:13: warning: symbol 's3info' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:140:5: warning: symbol 'startaddr' 
was not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:143:14: warning: symbol 'nfchunks' 
was not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:144:12: warning: symbol 'fchunk' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:152:7: warning: symbol 'pda' was not 
declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:153:21: warning: symbol 'nicid' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:154:20: warning: symbol 'rfid' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:155:20: warning: symbol 'macid' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:156:20: warning: symbol 'priid' was 
not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:193:5: warning: symbol 'prism2_fwtry' 
was not declared. Should it be static?
drivers/staging/wlan-ng/prism2fw.c:237:15: warning: memset with byte 
count of 120000
drivers/staging/wlan-ng/prism2fw.c:460:15: warning: memset with byte 
count of 120000
CC [M] drivers/staging/wlan-ng/prism2usb.o
In file included from drivers/staging/wlan-ng/prism2usb.c:5:0:
drivers/staging/wlan-ng/prism2fw.c: In function prism2_fwtry:
drivers/staging/wlan-ng/prism2fw.c:208:9: warning: format %d expects 
argument of type int, but argument 3 has type size_t [-Wformat]
drivers/staging/wlan-ng/prism2fw.c: In function writeimage:
drivers/staging/wlan-ng/prism2fw.c:1109:1: warning: the frame size of 
4272 bytes is larger than 2048 bytes [-Wframe-larger-than=]
CHECK drivers/staging/wlan-ng/p80211conv.c
CHECK drivers/staging/wlan-ng/p80211req.c
CHECK drivers/staging/wlan-ng/p80211wep.c
CHECK drivers/staging/wlan-ng/p80211wext.c
CHECK drivers/staging/wlan-ng/p80211netdev.c
LD [M] drivers/staging/wlan-ng/prism2_usb.o
==================================================

Best Regards!
wangyubin

On 03/12/2014 05:31 AM, m silverstri wrote:
> I am trying to use sparse to check my driver that I developed.
>
> >From http://kernelnewbies.org/Sparse, It said 'make C=2
> drivers/staging/wlan-ng/', what does it check it I  do 'make C=2' and
> how does it actually call 'spare'? Do I need to modify my Makefile to
> add a new target or something?
>
> Thank you.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> .
>
>






More information about the Kernelnewbies mailing list