Skip to contentSkip to conversation

scripts/dtc: Remove unused dts_version in dtc-lexer.l

PATCH In review Nathan Chancellor 2 participants 3 messages Mar 27 – Mar 30

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

PATCH 1/1 scripts/dtc: Remove unused dts_version in dtc-lexer.l

A recent strengthening of -Wunused-but-set-variable (enabled with -Wall) in clang under a new subwarning, -Wunused-but-set-global, points out an unused static global variable in dtc-lexer.lex.c (compiled from dtc-lexer.l):

scripts/dtc/dtc-lexer.lex.c:641:12: warning: variable 'dts_version' set but not used [-Wunused-but-set-global]

    641 | static int dts_version = 1;
        |            ^

This variable has been unused since commit 658f29a51e98 ("of/flattree:
Update dtc to current mainline."). Remove it to clear up the warning.

---
This is commit 53373d1 ("dtc: Remove unused dts_version in dtc-lexer.l") in upstream dtc. I sent it separately to make it easier to backport to stable, along with updating the warning and hash to match the kernel's version.

---
 scripts/dtc/dtc-lexer.l | 3 ---
 1 file changed, 3 deletions(-)
scripts/dtc/dtc-lexer.l +0 -3
index 15d585c80798..1b129b118b0f 100644
@@ -39,8 +39,6 @@ extern bool treesource_error;
 #define DPRINT(fmt, ...)	do { } while (0)
 #endif
 
-static int dts_version = 1;
-
 #define BEGIN_DEFAULT()		DPRINT("<V1>\n"); \
 				BEGIN(V1); \
 
@@ -101,7 +99,6 @@ static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
 
 <*>"/dts-v1/"	{
 			DPRINT("Keyword: /dts-v1/\n");
-			dts_version = 1;
 			BEGIN_DEFAULT();
 			return DT_V1;
 		}

---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260327-dtc-drop-dts_version-153e81c6641c

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>
maintainer
#1 lore raw
Quoted 15 lines · Nathan Chancellor

A recent strengthening of -Wunused-but-set-variable (enabled with -Wall) in clang under a new subwarning, -Wunused-but-set-global, points out an unused static global variable in dtc-lexer.lex.c (compiled from dtc-lexer.l):

scripts/dtc/dtc-lexer.lex.c:641:12: warning: variable 'dts_version' set but not used [-Wunused-but-set-global]

    641 | static int dts_version = 1;
        |            ^

This variable has been unused since commit 658f29a51e98 ("of/flattree:
Update dtc to current mainline."). Remove it to clear up the warning.

Quoted 8 lines

---
This is commit 53373d1 ("dtc: Remove unused dts_version in dtc-lexer.l") in upstream dtc. I sent it separately to make it easier to backport to stable, along with updating the warning and hash to match the kernel's version.

---
 scripts/dtc/dtc-lexer.l | 3 ---
 1 file changed, 3 deletions(-)

We don't take changes to dtc as we just sync with the upstream copy. I saw you already submitted this upstream, so I will do a sync to pull this in.

Rob

#2 lore raw
Quoted 25 lines · Rob Herring
Quoted 15 lines · Nathan Chancellor

A recent strengthening of -Wunused-but-set-variable (enabled with -Wall) in clang under a new subwarning, -Wunused-but-set-global, points out an unused static global variable in dtc-lexer.lex.c (compiled from dtc-lexer.l):

scripts/dtc/dtc-lexer.lex.c:641:12: warning: variable 'dts_version' set but not used [-Wunused-but-set-global]

    641 | static int dts_version = 1;
        |            ^

This variable has been unused since commit 658f29a51e98 ("of/flattree:
Update dtc to current mainline."). Remove it to clear up the warning.

Quoted 8 lines

---
This is commit 53373d1 ("dtc: Remove unused dts_version in dtc-lexer.l") in upstream dtc. I sent it separately to make it easier to backport to stable, along with updating the warning and hash to match the kernel's version.

---
 scripts/dtc/dtc-lexer.l | 3 ---
 1 file changed, 3 deletions(-)
Quoted 3 lines

We don't take changes to dtc as we just sync with the upstream copy. I saw you already submitted this upstream, so I will do a sync to pull this in.

Fair enough. As I mentioned in the fold, I will need this in stable so I figured having a separate patch would make that easier while not impacting a future sync (since it is already there). I can just wait to send this to stable directly until the sync lands in Linus's tree.

Cheers,
Nathan