Message ID | 20240510121355.3241456-19-hadess@hadess.net (mailing list archive) |
---|---|
State | Accepted |
Commit | e5925dbb84fa306275810016b244f69484c7e92f |
Headers | show |
Series | Fix a number of static analysis issues | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | fail | ERROR:INITIALISED_STATIC: do not initialise statics to NULL #83: FILE: monitor/jlink.c:50: +static void *so = NULL; /github/workspace/src/src/13661533.patch total: 1 errors, 0 warnings, 21 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/13661533.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. |
tedd_an/GitLint | fail | 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 (97>80): "bluez-5.75/monitor/jlink.c:87:3: alloc_fn: Storage is returned from allocation function "dlopen"." 7: B1 Line exceeds max length (115>80): "bluez-5.75/monitor/jlink.c:87:3: var_assign: Assigning: "so" = storage returned from "dlopen(jlink_so_name[i], 1)"." 8: B1 Line exceeds max length (95>80): "bluez-5.75/monitor/jlink.c:95:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 9: B1 Line exceeds max length (95>80): "bluez-5.75/monitor/jlink.c:96:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 10: B1 Line exceeds max length (95>80): "bluez-5.75/monitor/jlink.c:97:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 11: B1 Line exceeds max length (95>80): "bluez-5.75/monitor/jlink.c:98:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 12: B1 Line exceeds max length (95>80): "bluez-5.75/monitor/jlink.c:99:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 13: B1 Line exceeds max length (96>80): "bluez-5.75/monitor/jlink.c:100:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 14: B1 Line exceeds max length (96>80): "bluez-5.75/monitor/jlink.c:101:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 15: B1 Line exceeds max length (96>80): "bluez-5.75/monitor/jlink.c:102:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 16: B1 Line exceeds max length (96>80): "bluez-5.75/monitor/jlink.c:103:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 17: B1 Line exceeds max length (96>80): "bluez-5.75/monitor/jlink.c:104:2: noescape: Resource "so" is not freed or pointed-to in "dlsym"." 18: B1 Line exceeds max length (114>80): "bluez-5.75/monitor/jlink.c:116:2: leaked_storage: Variable "so" going out of scope leaks the storage it points to." 20: B3 Line contains hard tab characters (\t): "115| /* don't dlclose(so) here cause symbols from it are in use now */" 21: B3 Line contains hard tab characters (\t): "116|-> return 0;" |
diff --git a/monitor/jlink.c b/monitor/jlink.c index f9d4037f4cdf..e08cc87139c9 100644 --- a/monitor/jlink.c +++ b/monitor/jlink.c @@ -47,6 +47,7 @@ struct rtt_desc { }; static struct rtt_desc rtt_desc; +static void *so = NULL; typedef int (*jlink_emu_selectbyusbsn_func) (unsigned int sn); typedef int (*jlink_open_func) (void); @@ -80,7 +81,6 @@ static struct jlink jlink; int jlink_init(void) { - void *so; unsigned int i; for (i = 0; i < NELEM(jlink_so_name); i++) { @@ -109,6 +109,7 @@ int jlink_init(void) !jlink.emu_getproductname || !jlink.rtterminal_control || !jlink.rtterminal_read) { dlclose(so); + so = NULL; return -EIO; }