Skip to content

Commit 3a91daa

Browse files
logging: backend: mqtt: Fixed MQTT compiler warning
Added const qualifier to fix the compiler warning Signed-off-by: Venetia Furtado <[email protected]>
1 parent 8fa5154 commit 3a91daa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/logging/backends/log_backend_mqtt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ LOG_MODULE_REGISTER(log_backend_mqtt, CONFIG_LOG_DEFAULT_LEVEL);
2222
#include <errno.h>
2323

2424
static bool panic;
25-
static char *mqtt_topic = CONFIG_LOG_BACKEND_MQTT_TOPIC_DEFAULT;
25+
static const char *mqtt_topic = CONFIG_LOG_BACKEND_MQTT_TOPIC_DEFAULT;
2626
static uint8_t log_buf[CONFIG_LOG_BACKEND_MQTT_MAX_MSG_SIZE];
2727
static uint32_t log_format_current = CONFIG_LOG_BACKEND_MQTT_OUTPUT_DEFAULT;
2828

@@ -33,7 +33,7 @@ static int log_output_func(uint8_t *data, size_t length, void *output_ctx)
3333
struct mqtt_client *client = (struct mqtt_client *)output_ctx;
3434
struct mqtt_publish_param param = {0};
3535

36-
param.message.topic.topic.utf8 = (uint8_t *)mqtt_topic;
36+
param.message.topic.topic.utf8 = (const uint8_t *)mqtt_topic;
3737
param.message.topic.topic.size = strlen(mqtt_topic);
3838
param.message.topic.qos = CONFIG_LOG_BACKEND_MQTT_QOS;
3939
param.message.payload.data = data;

0 commit comments

Comments
 (0)