Skip to contentSkip to conversation

New: Syntax error. Not enough parameters for macro 'qla_printk'.

Bug 13519 [email protected] 2 participants 6 messages Jun 12, 2009 – Jun 29, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

http://bugzilla.kernel.org/show_bug.cgi?id=13519

Summary: Syntax error. Not enough parameters for macro
'qla_printk'.
Product: SCSI Drivers
Version: 2.5
Kernel Version: 2.6.30
Platform: All
OS/Version: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: QLOGIC QLA2XXX
AssignedTo: [email protected]
ReportedBy: [email protected]
Regression: No

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

Signature · 3 lines
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
#1 lore raw
Quoted 12 lines · On Fri, Jun 12, 2009 at 12:25:13PM +0000, [email protected]…

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"));
Quoted 6 lines

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.

Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#2 lore raw

[Bug 13519] Syntax error. Not enough parameters for macro 'qla_printk'.

In reply to [email protected]

http://bugzilla.kernel.org/show_bug.cgi?id=13519

--- Comment #1 from Matthew Wilcox <[email protected]> 2009-06-12 12:32:31 ---

Quoted 12 lines · On Fri, Jun 12, 2009 at 12:25:13PM +0000, [email protected]…

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"));
Quoted 6 lines

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.

Signature · 3 lines
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
#3 lore raw

[Bug 13519] Syntax error. Not enough parameters for macro 'qla_printk'.

In reply to [email protected]

http://bugzilla.kernel.org/show_bug.cgi?id=13519

--- Comment #2 from Martin Ettl <[email protected]> 2009-06-12 12:35:51 --- You are right, this is a false positive of cppcheck

Thanks anyway

Signature · 3 lines
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
#4 lore raw

[Bug 13519] Syntax error. Not enough parameters for macro 'qla_printk'.

In reply to [email protected]

http://bugzilla.kernel.org/show_bug.cgi?id=13519

Alan <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|                            |INVALID
Signature · 3 lines
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
#5 lore raw

[Bug 13519] Syntax error. Not enough parameters for macro 'qla_printk'.

In reply to [email protected]

http://bugzilla.kernel.org/show_bug.cgi?id=13519

Alan <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED

Signature · 3 lines
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.