What changed, and why it matters
This commit removes unused variables, unused function declarations, and unused local arrays across several firmware source files, and adds a couple of missing header includes. It also changes a few function signatures from `char *` to `const char *` for string parameters that are not modified. The stated purpose is simply to 'fix warning' (compiler warnings). None of these changes alter program logic, security boundaries, or cryptographic handling.
No security action required. Treat as routine code-quality/compiler-warning cleanup. Standard regression testing is sufficient.
Security signals we found
No security-relevant logic changes observed
Removed unused local buffers and unused AES context variable
Const-correctness improvements for UI string parameters
Added missing header includes for compilation correctness
Evidence from the diff
The diff is a cleanup/warning-fix patch. It deletes unused stack variables (cipher, plain, AES128_CBC_ctx aesCtx, g_hdPath, crypto, viewType, label, empty static helper stubs) and adds missing includes (drv_mpu.h, fetch_sensitive_data_task.h). It also const-corrects string parameters in CreateNoticeCard and CreateStellarNoticeCOntainer. No functional behavior, control flow, or security-critical code is changed. The removed AES128_CBC_ctx local was unused; the actual AES function body remains unchanged. The removed cipher/plain arrays in InitBootParam were unused after a prior refactor. The lv_anim_set_playback_delay(obj, 1000) call was removed because it was passing an lv_obj_t * to a function expecting an lv_anim_t *, i.e., a type-incorrect no-op that produced a warning.
Changed components
src/device_settings.csrc/driver/drv_ds28s60.csrc/driver/low_power.csrc/ui/gui_analyze/gui_analyze.csrc/ui/gui_chain/gui_chain_components.csrc/ui/gui_chain/gui_chain_components.hsrc/ui/gui_chain/multi/web3/gui_avax.csrc/ui/gui_chain/multi/web3/gui_cosmos.csrc/ui/gui_chain/multi/web3/gui_eth.csrc/ui/gui_chain/multi/web3/gui_stellar.cInspect captured patch +11 / −29
diff --git a/src/device_settings.c b/src/device_settings.c
index 8f335ec..cbfca4c 100644
--- a/src/device_settings.c
+++ b/src/device_settings.c
@@ -153,8 +153,6 @@ void InitBootParam(void)
#endif
BootParam_t bootParam;
bool needSave = false;
- uint8_t cipher[sizeof(g_bootParam)] = {0};
- uint8_t plain[sizeof(g_bootParam)] = {0};
Gd25FlashReadBuffer(BOOT_SECURE_PARAM_FLAG, (uint8_t *)&bootParam, sizeof(bootParam));
PrintArray("bootParam.bootCheckFlag", bootParam.bootCheckFlag, sizeof(bootParam.bootCheckFlag));
PrintArray("bootParam.recoveryModeSwitch", bootParam.recoveryModeSwitch, sizeof(bootParam.recoveryModeSwitch));
@@ -323,7 +321,6 @@ void SetUSBSwitch(uint32_t usbSwitch)
static void AesEncryptBuffer(uint8_t *cipher, uint32_t sz, uint8_t *plain)
{
- AES128_CBC_ctx aesCtx;
uint8_t key128[16] = {0};
uint8_t iv[16] = {0};
diff --git a/src/driver/drv_ds28s60.c b/src/driver/drv_ds28s60.c
index 728f2ac..24676b4 100644
--- a/src/driver/drv_ds28s60.c
+++ b/src/driver/drv_ds28s60.c
@@ -5,6 +5,7 @@
#include "string.h"
#include "mhscpu.h"
//#include "drv_spi.h"
+#include "drv_mpu.h"
#include "drv_spi_io.h"
#include "cmsis_os.h"
#include "user_memory.h"
diff --git a/src/driver/low_power.c b/src/driver/low_power.c
index 30dd2e9..98f6f46 100644
--- a/src/driver/low_power.c
+++ b/src/driver/low_power.c
@@ -29,6 +29,7 @@
#include "usb_task.h"
#include "gui_setup_widgets.h"
#include "device_setting.h"
+#include "fetch_sensitive_data_task.h"
#define RTC_WAKE_UP_INTERVAL_CHARGING (80) // 80 seconds
#define RTC_WAKE_UP_INTERVAL_DISCHARGE (60 * 15) // 15 minutes
diff --git a/src/ui/gui_analyze/gui_analyze.c b/src/ui/gui_analyze/gui_analyze.c
index 24216a5..eb9e48d 100644
--- a/src/ui/gui_analyze/gui_analyze.c
+++ b/src/ui/gui_analyze/gui_analyze.c
@@ -508,13 +508,12 @@ lv_obj_t *GuiCreateValueLabel(lv_obj_t *parent, const char *text, int indent, ui
static bool g_isJsonStringTooLong = false;
static void DisplayJsonRecursive(lv_obj_t *parent, cJSON *item, int indent, uint32_t *yOffset)
{
- lv_obj_t* label;
char buf[BUFFER_SIZE_256];
while (item != NULL) {
if (item->string != NULL) {
snprintf(buf, sizeof(buf), "%s:", item->string);
- label = GuiCreateValueLabel(parent, buf, indent, yOffset);
+ GuiCreateValueLabel(parent, buf, indent, yOffset);
}
if (cJSON_IsObject(item)) {
@@ -532,16 +531,16 @@ static void DisplayJsonRecursive(lv_obj_t *parent, cJSON *item, int indent, uint
} else {
snprintf_s(buf, sizeof(buf), "%s", item->valuestring);
}
- label = GuiCreateValueLabel(parent, buf, indent + 1, yOffset);
+ GuiCreateValueLabel(parent, buf, indent + 1, yOffset);
} else if (cJSON_IsNumber(item)) {
snprintf(buf, sizeof(buf), "%.0f", item->valuedouble);
- label = GuiCreateValueLabel(parent, buf, indent + 1, yOffset);
+ GuiCreateValueLabel(parent, buf, indent + 1, yOffset);
} else if (cJSON_IsBool(item)) {
snprintf(buf, sizeof(buf), "%*s%s", (indent + 1) * 2, "", item->valueint ? "true" : "false");
- label = GuiCreateValueLabel(parent, buf, indent, yOffset);
+ GuiCreateValueLabel(parent, buf, indent, yOffset);
} else if (cJSON_IsNull(item)) {
snprintf(buf, sizeof(buf), "%*snull", (indent + 1) * 2, "");
- label = GuiCreateValueLabel(parent, buf, indent, yOffset);
+ GuiCreateValueLabel(parent, buf, indent, yOffset);
}
item = item->next;
@@ -613,7 +612,6 @@ lv_obj_t *GuiWidgetLabel(lv_obj_t *parent, cJSON *json)
lv_obj_set_width(obj, textWidth);
lv_obj_set_style_anim_speed(obj, 100, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_anim_time(obj, 1000, LV_PART_MAIN | LV_STATE_DEFAULT);
- lv_anim_set_playback_delay(obj, 1000);
} else {
lv_label_set_long_mode(obj, LV_LABEL_LONG_WRAP);
lv_obj_set_width(obj, textWidth);
diff --git a/src/ui/gui_chain/gui_chain_components.c b/src/ui/gui_chain/gui_chain_components.c
index 1826f0b..6395e1b 100644
--- a/src/ui/gui_chain/gui_chain_components.c
+++ b/src/ui/gui_chain/gui_chain_components.c
@@ -262,7 +262,7 @@ lv_obj_t *CreateContentContainer(lv_obj_t *parent, uint16_t w, uint16_t h)
return container;
}
-lv_obj_t *CreateNoticeCard(lv_obj_t *parent, char *notice)
+lv_obj_t *CreateNoticeCard(lv_obj_t *parent, const char *notice)
{
uint16_t height = 24 + 36 + 8 + 24;
lv_obj_t* card = GuiCreateContainerWithParent(parent, 408, 24);
diff --git a/src/ui/gui_chain/gui_chain_components.h b/src/ui/gui_chain/gui_chain_components.h
index 568aa69..05d1de5 100644
--- a/src/ui/gui_chain/gui_chain_components.h
+++ b/src/ui/gui_chain/gui_chain_components.h
@@ -13,7 +13,7 @@ lv_obj_t *CreateSingleInfoView(lv_obj_t *parent, char* key, char *value);
lv_obj_t *CreateContentContainer(lv_obj_t *parent, uint16_t w, uint16_t h);
lv_obj_t *CreateValueDetailValue(lv_obj_t *parent, char* inputValue, char *outputValue, char *fee);
lv_obj_t *CreateDynamicInfoView(lv_obj_t *parent, char *key[], char *value[], int keyLen);
-lv_obj_t *CreateNoticeCard(lv_obj_t *parent, char* notice);
+lv_obj_t *CreateNoticeCard(lv_obj_t *parent, const char* notice);
lv_obj_t *CreateSingleInfoTwoLineView(lv_obj_t *parent, char* key, char *value);
lv_obj_t *CreateTransactionOvewviewCard(lv_obj_t *parent, const char* title1, const char* text1, const char* title2, const char* text2);
lv_obj_t *CreateNoticeView(lv_obj_t *parent, uint16_t width, uint16_t height, const char *notice);
diff --git a/src/ui/gui_chain/multi/web3/gui_avax.c b/src/ui/gui_chain/multi/web3/gui_avax.c
index c1cc703..afed427 100644
--- a/src/ui/gui_chain/multi/web3/gui_avax.c
+++ b/src/ui/gui_chain/multi/web3/gui_avax.c
@@ -23,8 +23,6 @@ static lv_obj_t *CreateOverviewAmountView(lv_obj_t *parent, DisplayAvaxTx *data,
static lv_obj_t *CreateOverviewActionView(lv_obj_t *parent, DisplayAvaxTx *data, lv_obj_t *lastView);
static lv_obj_t *CreateOverviewDestinationView(lv_obj_t *parent, DisplayAvaxTx *data, lv_obj_t *lastView);
static lv_obj_t *CreateOverviewContractDataView(lv_obj_t *parent, DisplayAvaxTx *data, lv_obj_t *lastView);
-static lv_obj_t *CreateDetailsDataViewView(lv_obj_t *parent, DisplayAvaxTx *data, lv_obj_t *lastView);
-static lv_obj_t *CreateDetailsRawDataView(lv_obj_t *parent, DisplayAvaxTx *data, lv_obj_t *lastView);
UREncodeResult *GetAvaxSignDataDynamic(bool isUnlimited);
void GuiSetAvaxUrData(URParseResult *urResult, URParseMultiResult *urMultiResult, bool multi)
@@ -247,13 +245,6 @@ void GuiAvaxTxRawData(lv_obj_t *parent, void *totalData)
lv_obj_update_layout(parent);
}
-static lv_obj_t *CreateDetailsDataViewView(lv_obj_t *parent, DisplayAvaxTx *data, lv_obj_t *lastView)
-{
-}
-static lv_obj_t *CreateDetailsRawDataView(lv_obj_t *parent, DisplayAvaxTx *data, lv_obj_t *lastView)
-{
-}
-
void FreeAvaxMemory(void)
{
CHECK_FREE_UR_RESULT(g_urResult, false);
diff --git a/src/ui/gui_chain/multi/web3/gui_cosmos.c b/src/ui/gui_chain/multi/web3/gui_cosmos.c
index 6921262..5e828fd 100644
--- a/src/ui/gui_chain/multi/web3/gui_cosmos.c
+++ b/src/ui/gui_chain/multi/web3/gui_cosmos.c
@@ -16,7 +16,6 @@ static URParseMultiResult *g_urMultiResult = NULL;
static void *g_parseResult = NULL;
static int8_t g_cosmosListIndex = -1;
static char g_cosmosAddr[MAX_COSMOS_ADDR_LEN];
-static char g_hdPath[26];
static const CosmosChain_t g_cosmosChains[COSMOS_CHAINS_LEN] = {
{CHAIN_BABYLON, HOME_WALLET_CARD_BABYLON, 118, "bbn", XPUB_TYPE_COSMOS, "baby_3535-1"},
{CHAIN_NEUTARO, HOME_WALLET_CARD_NEUTARO, 118, "neutaro", XPUB_TYPE_COSMOS, "Neutaro-1"},
diff --git a/src/ui/gui_chain/multi/web3/gui_eth.c b/src/ui/gui_chain/multi/web3/gui_eth.c
index 5df0fa9..bc84650 100644
--- a/src/ui/gui_chain/multi/web3/gui_eth.c
+++ b/src/ui/gui_chain/multi/web3/gui_eth.c
@@ -1073,13 +1073,10 @@ void *GuiGetEthData(void)
enum ViewType viewType = ViewTypeUnKnown;
enum QRCodeType urType = URTypeUnKnown;
- void *crypto = NULL;
if (g_isMulti) {
- crypto = g_urMultiResult->data;
urType = g_urMultiResult->ur_type;
viewType = g_urMultiResult->t;
} else {
- crypto = g_urResult->data;
urType = g_urResult->ur_type;
}
char *rootPath = NULL;
@@ -1119,13 +1116,11 @@ PtrT_TransactionCheckResult GuiGetEthCheckResult(void)
{
uint8_t mfp[4];
void *data = g_isMulti ? g_urMultiResult->data : g_urResult->data;
- enum ViewType viewType = ViewTypeUnKnown;
enum QRCodeType urType = URTypeUnKnown;
void *crypto = NULL;
if (g_isMulti) {
crypto = g_urMultiResult->data;
urType = g_urMultiResult->ur_type;
- viewType = g_urMultiResult->t;
} else {
crypto = g_urResult->data;
urType = g_urResult->ur_type;
diff --git a/src/ui/gui_chain/multi/web3/gui_stellar.c b/src/ui/gui_chain/multi/web3/gui_stellar.c
index 198bc0c..72668c2 100644
--- a/src/ui/gui_chain/multi/web3/gui_stellar.c
+++ b/src/ui/gui_chain/multi/web3/gui_stellar.c
@@ -5,7 +5,7 @@ static URParseResult *g_urResult = NULL;
static URParseMultiResult *g_urMultiResult = NULL;
static void *g_parseResult = NULL;
-static void CreateStellarNoticeCOntainer(lv_obj_t *parent, char *title, char *context, lv_coord_t w, lv_coord_t h);
+static void CreateStellarNoticeCOntainer(lv_obj_t *parent, const char *title, const char *context, lv_coord_t w, lv_coord_t h);
#define CHECK_FREE_PARSE_RESULT(result) \
if (result != NULL) \
@@ -89,7 +89,7 @@ UREncodeResult *GuiGetStellarSignQrCodeData(void)
return encodeResult;
}
-static void CreateStellarNoticeCOntainer(lv_obj_t *parent, char *title, char *context, lv_coord_t w, lv_coord_t h)
+static void CreateStellarNoticeCOntainer(lv_obj_t *parent, const char *title, const char *context, lv_coord_t w, lv_coord_t h)
{
lv_obj_clear_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_clear_flag(parent, LV_OBJ_FLAG_CLICKABLE);
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.