Linux bluetooth development
 help / color / mirror / Atom feed
* [BlueZ 1/3] mesh: Remove unused but set variable
@ 2026-05-11 11:35 Bastien Nocera
  2026-05-11 11:35 ` [BlueZ 2/3] mesh: Fix str{r,}chr usage Bastien Nocera
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bastien Nocera @ 2026-05-11 11:35 UTC (permalink / raw)
  To: linux-bluetooth

We played around with the bits, but didn't do anything with it.

mesh/net.c: In function ‘ack_received’:
mesh/net.c:1569:18: error: variable ‘ack_copy’ set but not used [-Werror=unused-but-set-variable=]
 1569 |         uint32_t ack_copy = ack_flag;
      |                  ^~~~~~~~
---
 mesh/net.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/mesh/net.c b/mesh/net.c
index b29e24f5d4a9..2c1be1f2cc63 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -1566,7 +1566,6 @@ static void ack_received(struct mesh_net *net, bool timeout,
 {
 	struct mesh_sar *outgoing;
 	uint32_t seg_flag = 0x00000001;
-	uint32_t ack_copy = ack_flag;
 	uint16_t i;
 
 	l_debug("ACK Rxed (%x) (to:%d): %8.8x", seq0, timeout, ack_flag);
@@ -1599,8 +1598,6 @@ static void ack_received(struct mesh_net *net, bool timeout,
 
 	outgoing->last_nak |= ack_flag;
 
-	ack_copy &= outgoing->flags;
-
 	for (i = 0; i <= SEG_MAX(true, outgoing->len); i++, seg_flag <<= 1) {
 		if (seg_flag & ack_flag) {
 			l_debug("Skipping Seg %d of %d",
@@ -1608,8 +1605,6 @@ static void ack_received(struct mesh_net *net, bool timeout,
 			continue;
 		}
 
-		ack_copy |= seg_flag;
-
 		l_debug("Resend Seg %d net:%p dst:%x app_idx:%3.3x",
 				i, net, outgoing->remote, outgoing->app_idx);
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [BlueZ 2/3] mesh: Fix str{r,}chr usage
  2026-05-11 11:35 [BlueZ 1/3] mesh: Remove unused but set variable Bastien Nocera
@ 2026-05-11 11:35 ` Bastien Nocera
  2026-05-11 11:35 ` [BlueZ 3/3] mesh: Fix const qualifier dropping when using strchr() Bastien Nocera
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Bastien Nocera @ 2026-05-11 11:35 UTC (permalink / raw)
  To: linux-bluetooth

Fix the code manipulating "const char *" return values from
json_object_to_json_string_ext() to modify it for printing, we're
not allowed to do that.

tools/mesh/mesh-db.c: In function ‘mesh_db_finish_export’:
tools/mesh/mesh-db.c:2598:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
 2598 |         pos = strrchr(hdr, '}');
      |             ^
tools/mesh/mesh-db.c:2604:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
 2604 |         pos = strrchr(hdr, '"');
      |             ^
tools/mesh/mesh-db.c:2613:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
 2613 |         pos = strchr(str, '{');
      |             ^
---
 tools/mesh/mesh-db.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
index fb9c436d1d06..7bb8ab53ecbb 100644
--- a/tools/mesh/mesh-db.c
+++ b/tools/mesh/mesh-db.c
@@ -2547,7 +2547,9 @@ void *mesh_db_prepare_export(void)
 bool mesh_db_finish_export(bool is_error, void *expt_cfg, const char *fname)
 {
 	FILE *outfile = NULL;
-	const char *str, *hdr;
+	const char *str_s, *hdr_s;
+	char *str = NULL;
+	char *hdr = NULL;
 	json_object *jhdr = NULL;
 	bool result = false;
 	char *pos;
@@ -2581,15 +2583,18 @@ bool mesh_db_finish_export(bool is_error, void *expt_cfg, const char *fname)
 	if (!add_string(jhdr, "version", schema_version))
 		goto done;
 
-	hdr = json_object_to_json_string_ext(jhdr, JSON_C_TO_STRING_PRETTY |
+	hdr_s = json_object_to_json_string_ext(jhdr, JSON_C_TO_STRING_PRETTY |
 						JSON_C_TO_STRING_NOSLASHESCAPE);
 
-	str = json_object_to_json_string_ext(expt_cfg, JSON_C_TO_STRING_PRETTY |
+	str_s = json_object_to_json_string_ext(expt_cfg, JSON_C_TO_STRING_PRETTY |
 						JSON_C_TO_STRING_NOSLASHESCAPE);
 
-	if (!hdr || !str)
+	if (!hdr_s || !str_s)
 		goto done;
 
+	hdr = strdup(hdr_s);
+	str = strdup(str_s);
+
 	/*
 	 * Write two strings to the output while stripping closing "}" from the
 	 * header string and opening "{" from the config object.
@@ -2624,6 +2629,10 @@ bool mesh_db_finish_export(bool is_error, void *expt_cfg, const char *fname)
 	result = true;
 
 done:
+	if (hdr != NULL)
+		free(hdr);
+	if (str != NULL)
+		free(str);
 	if (outfile)
 		fclose(outfile);
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [BlueZ 3/3] mesh: Fix const qualifier dropping when using strchr()
  2026-05-11 11:35 [BlueZ 1/3] mesh: Remove unused but set variable Bastien Nocera
  2026-05-11 11:35 ` [BlueZ 2/3] mesh: Fix str{r,}chr usage Bastien Nocera
@ 2026-05-11 11:35 ` Bastien Nocera
  2026-05-11 14:27 ` [BlueZ,1/3] mesh: Remove unused but set variable bluez.test.bot
  2026-05-12 19:20 ` [BlueZ 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: Bastien Nocera @ 2026-05-11 11:35 UTC (permalink / raw)
  To: linux-bluetooth

strchr() with a const string returns a const string, we don't change
that string or "next", so make both const and get rid of the warning.

mesh/util.c: In function ‘create_dir’:
mesh/util.c:108:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  108 |         prev = strchr(dir_name, '/');
      |              ^
---
 mesh/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mesh/util.c b/mesh/util.c
index 348401ae5582..a21882a2d9f0 100644
--- a/mesh/util.c
+++ b/mesh/util.c
@@ -95,7 +95,8 @@ size_t hex2str(const uint8_t *in, size_t in_len, char *out, size_t out_len)
 int create_dir(const char *dir_name)
 {
 	struct stat st;
-	char dir[PATH_MAX + 1], *prev, *next;
+	const char *prev, *next;
+	char dir[PATH_MAX + 1];
 	int err;
 
 	err = stat(dir_name, &st);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [BlueZ,1/3] mesh: Remove unused but set variable
  2026-05-11 11:35 [BlueZ 1/3] mesh: Remove unused but set variable Bastien Nocera
  2026-05-11 11:35 ` [BlueZ 2/3] mesh: Fix str{r,}chr usage Bastien Nocera
  2026-05-11 11:35 ` [BlueZ 3/3] mesh: Fix const qualifier dropping when using strchr() Bastien Nocera
@ 2026-05-11 14:27 ` bluez.test.bot
  2026-05-12 19:20 ` [BlueZ 1/3] " patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2026-05-11 14:27 UTC (permalink / raw)
  To: linux-bluetooth, hadess

[-- Attachment #1: Type: text/plain, Size: 4068 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1092724

---Test result---

Test Summary:
CheckPatch                    FAIL      1.45 seconds
GitLint                       FAIL      1.04 seconds
BuildEll                      PASS      20.50 seconds
BluezMake                     PASS      610.73 seconds
MakeCheck                     PASS      1.04 seconds
MakeDistcheck                 PASS      235.67 seconds
CheckValgrind                 PASS      201.97 seconds
CheckSmatch                   PASS      322.12 seconds
bluezmakeextell               PASS      164.82 seconds
IncrementalBuild              PASS      604.45 seconds
ScanBuild                     PASS      905.83 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,2/3] mesh: Fix str{r,}chr usage
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#95: FILE: tools/mesh/mesh-db.c:2589:
+	str_s = json_object_to_json_string_ext(expt_cfg, JSON_C_TO_STRING_PRETTY |

/github/workspace/src/patch/14565358.patch total: 0 errors, 1 warnings, 41 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/patch/14565358.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,1/3] mesh: Remove unused but set variable

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
6: B1 Line exceeds max length (98>80): "mesh/net.c:1569:18: error: variable ‘ack_copy’ set but not used [-Werror=unused-but-set-variable=]"
[BlueZ,2/3] mesh: Fix str{r,}chr usage

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
8: B1 Line exceeds max length (130>80): "tools/mesh/mesh-db.c:2598:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]"
11: B1 Line exceeds max length (130>80): "tools/mesh/mesh-db.c:2604:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]"
14: B1 Line exceeds max length (130>80): "tools/mesh/mesh-db.c:2613:13: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]"
[BlueZ,3/3] mesh: Fix const qualifier dropping when using strchr()

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
7: B1 Line exceeds max length (120>80): "mesh/util.c:108:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]"


https://github.com/bluez/bluez/pull/2117

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BlueZ 1/3] mesh: Remove unused but set variable
  2026-05-11 11:35 [BlueZ 1/3] mesh: Remove unused but set variable Bastien Nocera
                   ` (2 preceding siblings ...)
  2026-05-11 14:27 ` [BlueZ,1/3] mesh: Remove unused but set variable bluez.test.bot
@ 2026-05-12 19:20 ` patchwork-bot+bluetooth
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2026-05-12 19:20 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 11 May 2026 13:35:05 +0200 you wrote:
> We played around with the bits, but didn't do anything with it.
> 
> mesh/net.c: In function ‘ack_received’:
> mesh/net.c:1569:18: error: variable ‘ack_copy’ set but not used [-Werror=unused-but-set-variable=]
>  1569 |         uint32_t ack_copy = ack_flag;
>       |                  ^~~~~~~~
> 
> [...]

Here is the summary with links:
  - [BlueZ,1/3] mesh: Remove unused but set variable
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f95b524e5a1d
  - [BlueZ,2/3] mesh: Fix str{r,}chr usage
    (no matching commit)
  - [BlueZ,3/3] mesh: Fix const qualifier dropping when using strchr()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=7b2b51ac6f64

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-12 19:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 11:35 [BlueZ 1/3] mesh: Remove unused but set variable Bastien Nocera
2026-05-11 11:35 ` [BlueZ 2/3] mesh: Fix str{r,}chr usage Bastien Nocera
2026-05-11 11:35 ` [BlueZ 3/3] mesh: Fix const qualifier dropping when using strchr() Bastien Nocera
2026-05-11 14:27 ` [BlueZ,1/3] mesh: Remove unused but set variable bluez.test.bot
2026-05-12 19:20 ` [BlueZ 1/3] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox