2022-08-30 21:45:33

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] client/player: Fix checkpatch warning

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following checkpatch warning:

WARNING:LINE_SPACING: Missing a blank line after declarations
216: FILE: client/player.c:625:
+ GDBusProxy *proxy = l->data;
+ print_player(proxy, NULL);
---
client/player.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/client/player.c b/client/player.c
index 3d2f41cb3666..0daacabf3c27 100644
--- a/client/player.c
+++ b/client/player.c
@@ -604,8 +604,10 @@ static void print_media(GDBusProxy *proxy, const char *description)
g_free(str);
}

-static void print_player(GDBusProxy *proxy, const char *description)
+static void print_player(void *data, void *user_data)
{
+ GDBusProxy *proxy = data;
+ const char *description = user_data;
char *str;

str = proxy_description(proxy, "Player", description);
@@ -618,12 +620,7 @@ static void print_player(GDBusProxy *proxy, const char *description)

static void cmd_list(int argc, char *arg[])
{
- GList *l;
-
- for (l = players; l; l = g_list_next(l)) {
- GDBusProxy *proxy = l->data;
- print_player(proxy, NULL);
- }
+ g_list_foreach(players, print_player, NULL);

return bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
--
2.37.2


2022-08-30 21:45:33

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ 2/2] shared/shell: Fix scan-build error

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following error:

src/shared/shell.c:1135:19: warning: Null pointer passed to 1st
parameter expecting 'nonnull'
data.timeout = atoi(optarg);
^~~~~~~~~~~~
---
src/shared/shell.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 4658819a4bde..46ba8112cfb0 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1101,6 +1101,7 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
struct option options[256];
char optstr[256];
size_t offset;
+ char *endptr = NULL;

offset = sizeof(main_options) / sizeof(struct option);

@@ -1132,7 +1133,9 @@ void bt_shell_init(int argc, char **argv, const struct bt_shell_opt *opt)
data.mode = 1;
goto done;
case 't':
- data.timeout = atoi(optarg);
+ data.timeout = strtol(optarg, &endptr, 0);
+ if (!endptr || *endptr != '\0')
+ printf("Unable to parse timeout\n");
break;
case 'z':
data.zsh = 1;
--
2.37.2

2022-08-30 23:17:52

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,1/2] client/player: Fix checkpatch warning

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=672614

---Test result---

Test Summary:
CheckPatch FAIL 1.39 seconds
GitLint PASS 0.96 seconds
Prep - Setup ELL PASS 32.15 seconds
Build - Prep PASS 0.65 seconds
Build - Configure PASS 10.33 seconds
Build - Make PASS 980.25 seconds
Make Check PASS 12.90 seconds
Make Check w/Valgrind PASS 347.96 seconds
Make Distcheck PASS 300.51 seconds
Build w/ext ELL - Configure PASS 10.48 seconds
Build w/ext ELL - Make PASS 101.00 seconds
Incremental Build w/ patches PASS 242.98 seconds
Scan Build WARNING 684.12 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,1/2] client/player: Fix checkpatch warning
WARNING:EMAIL_SUBJECT: A patch subject line should describe the change not the tool that found it
#69:
Subject: [PATCH BlueZ 1/2] client/player: Fix checkpatch warning

/github/workspace/src/12959894.patch total: 0 errors, 1 warnings, 24 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/12959894.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: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
client/player.c:1755:25: warning: Dereference of null pointer
iov_append(&cfg->caps, preset->data.iov_base, preset->data.iov_len);
^~~~~~~~~~~~~~~~~~~~~
1 warning generated.
src/shared/shell.c:1136:19: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data.timeout = strtol(optarg, &endptr, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/shell.c:1158:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt')
if (c != opt->options[index - offset].val) {
^~~~~~~~~~~~
2 warnings generated.




---
Regards,
Linux Bluetooth

2022-08-31 23:15:22

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] client/player: Fix checkpatch warning

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Tue, 30 Aug 2022 14:42:14 -0700 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> This fixes the following checkpatch warning:
>
> WARNING:LINE_SPACING: Missing a blank line after declarations
> 216: FILE: client/player.c:625:
> + GDBusProxy *proxy = l->data;
> + print_player(proxy, NULL);
>
> [...]

Here is the summary with links:
- [BlueZ,1/2] client/player: Fix checkpatch warning
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d8febc76a43f
- [BlueZ,2/2] shared/shell: Fix scan-build error
(no matching commit)

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