diff mbox series

[BlueZ,01/20] src: const annotate the bluetooth plugin API

Message ID 20240116-const-v1-1-17c87978f40b@gmail.com
State New
Headers show
Series Constify all the things | expand

Commit Message

Emil Velikov via B4 Relay Jan. 16, 2024, 2 p.m. UTC
From: Emil Velikov <emil.velikov@collabora.com>

The data was never mutable, so there's no API/ABI breakage here.
---
 src/genbuiltin | 4 ++--
 src/log.c      | 2 +-
 src/plugin.c   | 6 +++---
 src/plugin.h   | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

Comments

bluez.test.bot@gmail.com Jan. 16, 2024, 6:37 p.m. UTC | #1
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=817220

---Test result---

Test Summary:
CheckPatch                    FAIL      6.32 seconds
GitLint                       PASS      3.96 seconds
BuildEll                      PASS      23.78 seconds
BluezMake                     PASS      712.63 seconds
MakeCheck                     PASS      12.07 seconds
MakeDistcheck                 PASS      158.82 seconds
CheckValgrind                 PASS      219.94 seconds
CheckSmatch                   WARNING   325.30 seconds
bluezmakeextell               PASS      105.45 seconds
IncrementalBuild              PASS      13281.67 seconds
ScanBuild                     WARNING   928.49 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,01/20] src: const annotate the bluetooth plugin API
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#119: FILE: src/plugin.c:45:
+static gboolean add_plugin(void *handle, const struct bluetooth_plugin_desc *desc)

WARNING:LONG_LINE: line length of 85 exceeds 80 columns
#141: FILE: src/plugin.h:26:
+		const struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \

WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#150: FILE: src/plugin.h:35:
+		extern const struct bluetooth_plugin_desc bluetooth_plugin_desc \

/github/workspace/src/src/13520846.patch total: 0 errors, 3 warnings, 64 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/src/13520846.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.


[BlueZ,02/20] monitor: const annotate util_ltv_debugger instances and API
WARNING:LONG_LINE: line length of 84 exceeds 80 columns
#75: FILE: monitor/att.c:686:
+			const struct util_ltv_debugger *decoder, size_t decoder_len)

WARNING:LONG_LINE: line length of 84 exceeds 80 columns
#84: FILE: monitor/att.c:708:
+			const struct util_ltv_debugger *decoder, size_t decoder_len)

/github/workspace/src/src/13520847.patch total: 0 errors, 2 warnings, 48 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/src/13520847.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.


[BlueZ,03/20] monitor: const annotate cmd/handler tables
WARNING:LONG_LINE: line length of 84 exceeds 80 columns
#146: FILE: monitor/att.c:3160:
+static const struct bcast_audio_scan_cp_cmd *bcast_audio_scan_cp_get_cmd(uint8_t op)

/github/workspace/src/src/13520848.patch total: 0 errors, 1 warnings, 136 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/src/13520848.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.


[BlueZ,04/20] monitor: const annotate misc arrays
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#158: FILE: monitor/rfcomm.c:35:
+static const char *cr_str[] = {

/github/workspace/src/src/13520855.patch total: 0 errors, 1 warnings, 80 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/src/13520855.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.


[BlueZ,07/20] profiles: annotate immutable data as const
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#165: FILE: profiles/audio/sink.c:65:
+static const char *str_state[] = {

WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#178: FILE: profiles/audio/source.c:64:
+static const char *str_state[] = {

WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#191: FILE: profiles/audio/transport.c:58:
+static const char *str_state[] = {

WARNING:LONG_LINE: line length of 83 exceeds 80 columns
#218: FILE: profiles/audio/transport.c:1765:
+static const struct media_transport_ops *media_transport_find_ops(const char *uuid)

/github/workspace/src/src/13520849.patch total: 0 errors, 4 warnings, 185 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/src/13520849.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.


[BlueZ,11/20] gobex: const annotate RO arrays, use G_N_ELEMENTS
WARNING:LONG_LINE: line length of 90 exceeds 80 columns
#102: FILE: gobex/gobex.c:1446:
+			gobex_debug = g_parse_debug_string(env, keys, G_N_ELEMENTS(keys));

/github/workspace/src/src/13520860.patch total: 0 errors, 1 warnings, 32 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/src/13520860.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.


[BlueZ,13/20] lib: const annotate tupla instances and API
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#117: FILE: lib/sdp.c:190:
+static const char *string_lookup_uuid(const struct tupla *pt0, const uuid_t *uuid)

WARNING:LONG_LINE: line length of 89 exceeds 80 columns
#126: FILE: lib/sdp.c:212:
+static int uuid2str(const struct tupla *message, const uuid_t *uuid, char *str, size_t n)

/github/workspace/src/src/13520857.patch total: 0 errors, 2 warnings, 66 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/src/13520857.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.


[BlueZ,16/20] obexd: const obex_mime_type_driver instances and API
WARNING:LONG_LINE: line length of 85 exceeds 80 columns
#301: FILE: obexd/src/mimetype.c:137:
+const struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,

WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#331: FILE: obexd/src/mimetype.c:186:
+void obex_mime_type_driver_unregister(const struct obex_mime_type_driver *driver)

WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#347: FILE: obexd/src/mimetype.h:34:
+void obex_mime_type_driver_unregister(const struct obex_mime_type_driver *driver);

WARNING:LONG_LINE: line length of 85 exceeds 80 columns
#348: FILE: obexd/src/mimetype.h:35:
+const struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,

/github/workspace/src/src/13520859.patch total: 0 errors, 4 warnings, 224 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/src/13520859.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.


[BlueZ,18/20] obexd: const obex_transport_driver instances and API
WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#195: FILE: obexd/src/transport.c:70:
+void obex_transport_driver_unregister(const struct obex_transport_driver *driver)

WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#211: FILE: obexd/src/transport.h:21:
+void obex_transport_driver_unregister(const struct obex_transport_driver *driver);

/github/workspace/src/src/13520863.patch total: 0 errors, 2 warnings, 108 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/src/13520863.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.


[BlueZ,19/20] obexd: const annotate misc immutable data
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#154: FILE: obexd/plugins/phonebook-ebook.c:58:
+static const char *attribute_mask[] = {

/github/workspace/src/src/13520864.patch total: 0 errors, 1 warnings, 80 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/src/13520864.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: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/l2cap.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.attrib/gatttool.c:235:23: warning: Variable length array is used.attrib/interactive.c: note: in included file (through /usr/include/readline/readline.h):attrib/interactive.c:174:27: warning: non-ANSI function declaration of function 'disconnect_io'attrib/interactive.c:299:23: warning: Variable length array is used.emulator/bthost.c:584:28: warning: Variable length array is used.emulator/bthost.c:741:28: warning: Variable length array is used.
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
obexd/src/obex.c:123:3: warning: Access to field 'close' results in a dereference of a null pointer (loaded from field 'driver')
                os->driver->close(os->object);
                ^~~~~~~~~~~~~~~~~
1 warning generated.profiles/health/hdp_util.c:1052:2: warning: Use of memory after it is freed
        conn_data->func(conn_data->data, gerr);
        ^~~~~~~~~~~~~~~
1 warning generated.



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/genbuiltin b/src/genbuiltin
index 8b6f04761..010e4ed2f 100755
--- a/src/genbuiltin
+++ b/src/genbuiltin
@@ -2,11 +2,11 @@ 
 
 for i in $*
 do
-	echo "extern struct bluetooth_plugin_desc __bluetooth_builtin_$i;"
+	echo "extern const struct bluetooth_plugin_desc __bluetooth_builtin_$i;"
 done
 
 echo
-echo "static struct bluetooth_plugin_desc *__bluetooth_builtin[] = {"
+echo "static const struct bluetooth_plugin_desc *__bluetooth_builtin[] = {"
 
 for i in $*
 do
diff --git a/src/log.c b/src/log.c
index 0155a6bba..ca8ae2d0e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -123,7 +123,7 @@  extern struct btd_debug_desc __stop___debug[];
 
 static char **enabled = NULL;
 
-static gboolean is_enabled(struct btd_debug_desc *desc)
+static gboolean is_enabled(const struct btd_debug_desc *desc)
 {
 	int i;
 
diff --git a/src/plugin.c b/src/plugin.c
index 80990f8c3..69c4138f0 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -31,7 +31,7 @@  static GSList *plugins = NULL;
 struct bluetooth_plugin {
 	void *handle;
 	gboolean active;
-	struct bluetooth_plugin_desc *desc;
+	const struct bluetooth_plugin_desc *desc;
 };
 
 static int compare_priority(gconstpointer a, gconstpointer b)
@@ -42,7 +42,7 @@  static int compare_priority(gconstpointer a, gconstpointer b)
 	return plugin2->desc->priority - plugin1->desc->priority;
 }
 
-static gboolean add_plugin(void *handle, struct bluetooth_plugin_desc *desc)
+static gboolean add_plugin(void *handle, const struct bluetooth_plugin_desc *desc)
 {
 	struct bluetooth_plugin *plugin;
 
@@ -141,7 +141,7 @@  gboolean plugin_init(const char *enable, const char *disable)
 		goto start;
 
 	while ((file = g_dir_read_name(dir)) != NULL) {
-		struct bluetooth_plugin_desc *desc;
+		const struct bluetooth_plugin_desc *desc;
 		void *handle;
 		char *filename;
 
diff --git a/src/plugin.h b/src/plugin.h
index a5f92a557..dcf54a5bf 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -23,7 +23,7 @@  struct bluetooth_plugin_desc {
 
 #ifdef BLUETOOTH_PLUGIN_BUILTIN
 #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \
-		struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
+		const struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
 			#name, version, priority, init, exit \
 		};
 #else
@@ -32,9 +32,9 @@  struct bluetooth_plugin_desc {
 				__attribute__ ((weak, visibility("hidden"))); \
 		extern struct btd_debug_desc __stop___debug[] \
 				__attribute__ ((weak, visibility("hidden"))); \
-		extern struct bluetooth_plugin_desc bluetooth_plugin_desc \
+		extern const struct bluetooth_plugin_desc bluetooth_plugin_desc \
 				__attribute__ ((visibility("default"))); \
-		struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
+		const struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
 			#name, version, priority, init, exit, \
 			__start___debug, __stop___debug \
 		};