Bug 13519 - Syntax error. Not enough parameters for macro 'qla_printk'.
Summary: Syntax error. Not enough parameters for macro 'qla_printk'.
Status: CLOSED INVALID
Alias: None
Product: SCSI Drivers
Classification: Unclassified
Component: QLOGIC QLA2XXX (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: scsi_drivers-qla2xxx
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-12 12:25 UTC by Martin Ettl
Modified: 2009-06-29 11:50 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.30
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Martin Ettl 2009-06-12 12:25:12 UTC
Hi,

i have detected a wrong macro call in file qla_sup.c. To detect this issue i used the static code analysis tool cppcheck. It prints the following output:

[linux-2.6.30/drivers/scsi/qla2xxx/qla_sup.c:352]: (error) Syntax error. Not enough parameters for macro 'qla_printk'.

Take a look at file qla_sup.c line 352 

				DEBUG9_10(qla_printk(
				    "NVRAM didn't go ready...\n"));
				

The maro definition is in file qla_def.h (2657):

#define qla_printk(level, ha, format, arg...) \
	dev_printk(level , &((ha)->pdev->dev) , format , ## arg)

As you can see, it needs more than one parameter.

Best regards

Ettl Martin
Comment 1 Matthew Wilcox 2009-06-12 12:32:31 UTC
On Fri, Jun 12, 2009 at 12:25:13PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> i have detected a wrong macro call in file qla_sup.c. To detect this issue i
> used the static code analysis tool cppcheck. It prints the following output:
> 
> [linux-2.6.30/drivers/scsi/qla2xxx/qla_sup.c:352]: (error) Syntax error. Not
> enough parameters for macro 'qla_printk'.
> 
> Take a look at file qla_sup.c line 352 
> 
>                 DEBUG9_10(qla_printk(
>                     "NVRAM didn't go ready...\n"));
> 
> 
> The maro definition is in file qla_def.h (2657):
> 
> #define qla_printk(level, ha, format, arg...) \
>     dev_printk(level , &((ha)->pdev->dev) , format , ## arg)
> 
> As you can see, it needs more than one parameter.

I believe your tool is defective.  As I understand the way variadic
macros work, if there is no 'arg', the ## operator swallows up the
preceeding symbol (ie the ',') and so you'll get:

	dev_printk(level , &((ha)->pdev->dev) , format);

which is perfectly fine.
Comment 2 Martin Ettl 2009-06-12 12:35:51 UTC
You are right, this is a false positive of cppcheck

Thanks anyway

Note You need to log in before you can comment on or make changes to this bug.