Skip to contentSkip to conversation

|WARNING| pw23442 [PATCH] net/tap: add support for fixed mac addresses

DISCUSSION Wiles, Keith 2 participants 2 messages Apr 10, 2017 – Apr 11, 2017 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Begin forwarded message:

From: <[email protected]<mailto:[email protected]>>
Subject: |WARNING| pw23442 [PATCH] net/tap: add support for fixed mac addresses
Date: April 10, 2017 at 1:20:18 PM CDT
To: <[email protected]<mailto:[email protected]>>
Cc: Keith Wiles <[email protected]<mailto:[email protected]>>

Test-Label: checkpatch
Test-Status: WARNING
http://dpdk.org/patch/23442

_coding style issues_

CHECK:BRACES: braces {} should be used on all arms of this statement #100: FILE: drivers/net/tap/rte_eth_tap.c:1242:
+ if (fixed_mac_type) {
[...]
+ } else
[...]

CHECK:BRACES: Unbalanced braces around else statement #109: FILE: drivers/net/tap/rte_eth_tap.c:1251:
+ } else

total: 0 errors, 0 warnings, 2 checks, 123 lines checked

Got the above error running checkpatch locally then got the email above and I assumed this warning can be ignored is this the case?

Code that caused the warning:

} else {
if (fixed_mac_type) {
static int iface_idx;

pmd->eth_addr.addr_bytes[0] = 0x00;
pmd->eth_addr.addr_bytes[1] = 'd';
pmd->eth_addr.addr_bytes[2] = 't';
pmd->eth_addr.addr_bytes[3] = 'a';
pmd->eth_addr.addr_bytes[4] = 'p';
pmd->eth_addr.addr_bytes[5] = 0 + iface_idx++;
} else
eth_random_addr((uint8_t *)&pmd->eth_addr); <<<<<
}

Regards,
Keith

#2 lore raw
Quoted 24 lines · Keith

Begin forwarded message:

From: <[email protected]<mailto:[email protected]>>
Subject: |WARNING| pw23442 [PATCH] net/tap: add support for fixed mac addresses
Date: April 10, 2017 at 1:20:18 PM CDT
To: <[email protected]<mailto:[email protected]>>
Cc: Keith Wiles <[email protected]<mailto:[email protected]>>

Test-Label: checkpatch
Test-Status: WARNING
http://dpdk.org/patch/23442

_coding style issues_

CHECK:BRACES: braces {} should be used on all arms of this statement #100: FILE: drivers/net/tap/rte_eth_tap.c:1242:
+ if (fixed_mac_type) {
[...]
+ } else
[...]

Quoted 7 lines

CHECK:BRACES: Unbalanced braces around else statement #109: FILE: drivers/net/tap/rte_eth_tap.c:1251:
+ } else

total: 0 errors, 0 warnings, 2 checks, 123 lines checked

Got the above error running checkpatch locally then got the email above and I assumed this warning can be ignored is this the case?

Linux requires, if "if" or "else" part is multi-line, both block should use brackets, that is the reason of the warning.

But DPDK does not requires this:
http://dpdk.org/doc/guides/contributing/coding_style.html#control-statements-and-loops

For DPDK, this is free to ignore.

Quoted 20 lines

Code that caused the warning:

} else {
if (fixed_mac_type) {
static int iface_idx;

pmd->eth_addr.addr_bytes[0] = 0x00;
pmd->eth_addr.addr_bytes[1] = 'd';
pmd->eth_addr.addr_bytes[2] = 't';
pmd->eth_addr.addr_bytes[3] = 'a';
pmd->eth_addr.addr_bytes[4] = 'p';
pmd->eth_addr.addr_bytes[5] = 0 + iface_idx++;
} else
eth_random_addr((uint8_t *)&pmd->eth_addr); <<<<<
}

Regards,
Keith