Skip to contentSkip to conversation

net: tulip: Adjust indentation in {dmfe,uli526x}_init_module

PATCH Applied Nathan Chancellor 3 participants 4 messages Dec 9, 2019 – Dec 10, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: tulip: Adjust indentation in {dmfe,uli526x}_init_module

Clang warns:

../drivers/net/ethernet/dec/tulip/uli526x.c:1812:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch (mode) {
        ^
../drivers/net/ethernet/dec/tulip/uli526x.c:1809:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

../drivers/net/ethernet/dec/tulip/dmfe.c:2217:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch(mode) {
        ^
../drivers/net/ethernet/dec/tulip/dmfe.c:2214:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

This warning occurs because there is a space before the tab on these lines. Remove them so that the indentation is consistent with the Linux kernel coding style and clang no longer warns.

While we are here, adjust the default block in dmfe_init_module to have a proper break between the label and assignment and add a space between the switch and opening parentheses to avoid a checkpatch warning.

Fixes e1c3e5014040 ("[PATCH] initialisation cleanup for ULI526x-net-driver")
---
 drivers/net/ethernet/dec/tulip/dmfe.c    | 7 ++++---
 drivers/net/ethernet/dec/tulip/uli526x.c | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/dec/tulip/dmfe.c +4 -3
index 0efdbd1a4a6f..32d470d4122a 100644
@@ -2214,15 +2214,16 @@ static int __init dmfe_init_module(void)
 	if (cr6set)
 		dmfe_cr6_user_set = cr6set;
 
- 	switch(mode) {
-   	case DMFE_10MHF:
+	switch (mode) {
+	case DMFE_10MHF:
 	case DMFE_100MHF:
 	case DMFE_10MFD:
 	case DMFE_100MFD:
 	case DMFE_1M_HPNA:
 		dmfe_media_mode = mode;
 		break;
-	default:dmfe_media_mode = DMFE_AUTO;
+	default:
+		dmfe_media_mode = DMFE_AUTO;
 		break;
 	}
 
drivers/net/ethernet/dec/tulip/uli526x.c +2 -2
index b1f30b194300..117ffe08800d 100644
@@ -1809,8 +1809,8 @@ static int __init uli526x_init_module(void)
 	if (cr6set)
 		uli526x_cr6_user_set = cr6set;
 
- 	switch (mode) {
-   	case ULI526X_10MHF:
+	switch (mode) {
+	case ULI526X_10MHF:
 	case ULI526X_100MHF:
 	case ULI526X_10MFD:
 	case ULI526X_100MFD:
Signature · 1 line
2.24.0
#1 lore raw
Quoted 29 lines · Nathan Chancellor

Clang warns:

../drivers/net/ethernet/dec/tulip/uli526x.c:1812:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch (mode) {
        ^
../drivers/net/ethernet/dec/tulip/uli526x.c:1809:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

../drivers/net/ethernet/dec/tulip/dmfe.c:2217:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch(mode) {
        ^
../drivers/net/ethernet/dec/tulip/dmfe.c:2214:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

This warning occurs because there is a space before the tab on these lines. Remove them so that the indentation is consistent with the Linux kernel coding style and clang no longer warns.

Quoted 7 lines

While we are here, adjust the default block in dmfe_init_module to have a proper break between the label and assignment and add a space between the switch and opening parentheses to avoid a checkpatch warning.

Fixes e1c3e5014040 ("[PATCH] initialisation cleanup for ULI526x-net-driver")

/^ \t
in vim turns up a few more cases that I think should be fixed (in both files)

Quoted 51 lines
---
 drivers/net/ethernet/dec/tulip/dmfe.c    | 7 ++++---
 drivers/net/ethernet/dec/tulip/uli526x.c | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/dec/tulip/dmfe.c +4 -3
index 0efdbd1a4a6f..32d470d4122a 100644
@@ -2214,15 +2214,16 @@ static int __init dmfe_init_module(void)
        if (cr6set)
                dmfe_cr6_user_set = cr6set;
 
-       switch(mode) {
-       case DMFE_10MHF:
+       switch (mode) {
+       case DMFE_10MHF:
        case DMFE_100MHF:
        case DMFE_10MFD:
        case DMFE_100MFD:
        case DMFE_1M_HPNA:
                dmfe_media_mode = mode;
                break;
-       default:dmfe_media_mode = DMFE_AUTO;
+       default:
+               dmfe_media_mode = DMFE_AUTO;
                break;
        }
 
drivers/net/ethernet/dec/tulip/uli526x.c +2 -3
index b1f30b194300..117ffe08800d 100644
@@ -1809,8 +1809,8 @@ static int __init uli526x_init_module(void)
        if (cr6set)
                uli526x_cr6_user_set = cr6set;
 
-       switch (mode) {
-       case ULI526X_10MHF:
+       switch (mode) {
+       case ULI526X_10MHF:
        case ULI526X_100MHF:
        case ULI526X_10MFD:
        case ULI526X_100MFD:
--

2.24.0

--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20191209211623.44166-1-natechancellor%40gmail.com.

Signature · 2 lines
Thanks,
~Nick Desaulniers
maintainer Applied
#2 lore raw
In reply to Nathan Chancellor

From: Nathan Chancellor <[email protected]>
Date: Mon, 9 Dec 2019 14:16:23 -0700

Quoted 28 lines

Clang warns:

../drivers/net/ethernet/dec/tulip/uli526x.c:1812:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch (mode) {
        ^
../drivers/net/ethernet/dec/tulip/uli526x.c:1809:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

../drivers/net/ethernet/dec/tulip/dmfe.c:2217:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch(mode) {
        ^
../drivers/net/ethernet/dec/tulip/dmfe.c:2214:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

This warning occurs because there is a space before the tab on these lines. Remove them so that the indentation is consistent with the Linux kernel coding style and clang no longer warns.

Quoted 7 lines

While we are here, adjust the default block in dmfe_init_module to have a proper break between the label and assignment and add a space between the switch and opening parentheses to avoid a checkpatch warning.

Fixes e1c3e5014040 ("[PATCH] initialisation cleanup for ULI526x-net-driver")

Applied, but it's really crummy that the tool gets tripped up by the fact that a space preceeds the TAB. It's what the code visually looks like, not what exact kinds of SPACE characters were used to get there.

#3 lore raw
Quoted 35 lines · David Miller

From: Nathan Chancellor <[email protected]>
Date: Mon, 9 Dec 2019 14:16:23 -0700

Quoted 32 lines

Clang warns:

../drivers/net/ethernet/dec/tulip/uli526x.c:1812:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch (mode) {
        ^
../drivers/net/ethernet/dec/tulip/uli526x.c:1809:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

../drivers/net/ethernet/dec/tulip/dmfe.c:2217:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]

        switch(mode) {
        ^
../drivers/net/ethernet/dec/tulip/dmfe.c:2214:2: note: previous
statement is here
        if (cr6set)
        ^

1 warning generated.

This warning occurs because there is a space before the tab on these lines. Remove them so that the indentation is consistent with the Linux kernel coding style and clang no longer warns.

While we are here, adjust the default block in dmfe_init_module to have a proper break between the label and assignment and add a space between the switch and opening parentheses to avoid a checkpatch warning.

Quoted 7 lines
Quoted 3 lines
Fixes e1c3e5014040 ("[PATCH] initialisation cleanup for ULI526x-net-driver")

Applied, but it's really crummy that the tool gets tripped up by the fact that a space preceeds the TAB. It's what the code visually looks like, not what exact kinds of SPACE characters were used to get there.

I agree. There is a follow up patch from the author of the warning that claims to alieviate some of these but that is still in discussion and as far as I understand it, it won't fix all of them so I'm just dealing with all of them on the Linux side.

https://reviews.llvm.org/D71037

Thanks for picking them up!
Nathan