src: fix issues reported by clang-tidy

Some of those are simply ignored as they're false positives.
This commit is contained in:
Arnaud Ferraris
2024-10-29 15:03:45 +01:00
parent 2c311b9022
commit f978b775e0
5 changed files with 16 additions and 11 deletions

View File

@@ -56,14 +56,14 @@ static void at_free_command(gpointer cmd, gpointer data)
if (!at_cmd) if (!at_cmd)
return; return;
if (manager && manager->at_cmds)
manager->at_cmds = g_list_remove(manager->at_cmds, at_cmd);
g_free(at_cmd->cmd); g_free(at_cmd->cmd);
g_free(at_cmd->subcmd); g_free(at_cmd->subcmd);
g_free(at_cmd->value); g_free(at_cmd->value);
g_free(at_cmd->expected); g_free(at_cmd->expected);
g_free(at_cmd); g_free(at_cmd);
if (manager && manager->at_cmds)
manager->at_cmds = g_list_remove(manager->at_cmds, at_cmd);
} }
gboolean at_send_command(struct EG25Manager *manager) gboolean at_send_command(struct EG25Manager *manager)

View File

@@ -246,18 +246,19 @@ static void fetch_assistance_data(struct EG25Manager *manager)
g_message("Fetching GNSS assistance data from %s was successful", url); g_message("Fetching GNSS assistance data from %s was successful", url);
fflush(tmp_file);
curl_easy_cleanup(curl);
/* Go to the next step */ /* Go to the next step */
manager->gnss_assistance_step++; manager->gnss_assistance_step++;
gnss_step(manager); gnss_step(manager);
return;
goto cleanup;
bail: bail:
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;
cleanup:
fflush(tmp_file);
fclose(tmp_file);
if (curl != NULL) if (curl != NULL)
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;
} }
/******************************************************************************/ /******************************************************************************/

View File

@@ -258,7 +258,7 @@ int gpio_all_chip_paths(char ***paths_ptr)
struct gpiod_chip *gpio_chip_open_by_label(const char *label) struct gpiod_chip *gpio_chip_open_by_label(const char *label)
{ {
int num_chips, i; int num_chips, i;
char **paths; char **paths = NULL;
const char *clabel; const char *clabel;
struct gpiod_chip *chip; struct gpiod_chip *chip;
struct gpiod_chip_info *cinfo; struct gpiod_chip_info *cinfo;

View File

@@ -282,6 +282,7 @@ void suspend_init(struct EG25Manager *manager, toml_table_t *config[])
manager->modem_recovery_timeout = 9; manager->modem_recovery_timeout = 9;
g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM,
// NOLINTNEXTLINE Flags combination is valid even if not matching an enum entry
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
NULL, NULL,

View File

@@ -396,7 +396,11 @@ static int e_keyexists(context_t *ctx, int lineno)
static void *expand(void *p, int sz, int newsz) static void *expand(void *p, int sz, int newsz)
{ {
void *s = MALLOC(newsz); void *s;
if (!p)
return 0;
s = MALLOC(newsz);
if (!s) if (!s)
return 0; return 0;
@@ -1499,7 +1503,6 @@ toml_table_t *toml_parse_file(FILE *fp, char *errbuf, int errbufsz)
return 0; return 0;
} }
buf = x; buf = x;
bufsz = xsz;
} }
buf[off] = 0; buf[off] = 0;