From 25d3136d0240dc3115675f0e92942e7ce4b51a6e Mon Sep 17 00:00:00 2001 From: yangpeng Date: Sun, 4 Feb 2024 10:20:18 +0800 Subject: [PATCH] fix MDK AC5 build warnings --- .../stm32l475-atk-pandora/board/ports/wlan/drv_wlan.c | 1 - components/drivers/sdio/gpt.c | 8 +++++--- components/drivers/wlan/wlan_mgnt.c | 3 ++- components/finsh/cmd.c | 1 - components/finsh/msh.c | 6 ++++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/wlan/drv_wlan.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/wlan/drv_wlan.c index 431a18008c..25d45fff4c 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/wlan/drv_wlan.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/wlan/drv_wlan.c @@ -35,7 +35,6 @@ extern int wifi_hw_init(void); extern void wwd_thread_notify_irq(void); -static const struct fal_partition *partition = RT_NULL; static rt_uint32_t init_flag = 0; struct rt_wlan_device *bcm_hw_wlan_dev_alloc(void) diff --git a/components/drivers/sdio/gpt.c b/components/drivers/sdio/gpt.c index e8368ce529..53b686e9f6 100644 --- a/components/drivers/sdio/gpt.c +++ b/components/drivers/sdio/gpt.c @@ -186,12 +186,13 @@ static int is_gpt_valid(struct rt_mmcsd_card *card, size_t lba, gpt_header **gpt { size_t lastlba; - if (!ptes) + if (!ptes || !gpt) { return 0; } - if (!(*gpt = alloc_read_gpt_header(card, lba))) + *gpt = alloc_read_gpt_header(card, lba); + if (!(*gpt)) { return 0; } @@ -255,7 +256,8 @@ static int is_gpt_valid(struct rt_mmcsd_card *card, size_t lba, gpt_header **gpt goto fail; } - if (!(*ptes = alloc_read_gpt_entries(card, *gpt))) + *ptes = alloc_read_gpt_entries(card, *gpt); + if (!(*ptes)) { goto fail; } diff --git a/components/drivers/wlan/wlan_mgnt.c b/components/drivers/wlan/wlan_mgnt.c index b598687b6b..9fae21afff 100644 --- a/components/drivers/wlan/wlan_mgnt.c +++ b/components/drivers/wlan/wlan_mgnt.c @@ -837,7 +837,7 @@ rt_wlan_mode_t rt_wlan_get_mode(const char *dev_name) return mode; } - +#ifdef RT_WLAN_JOIN_SCAN_BY_MGNT static void rt_wlan_join_scan_callback(int event, struct rt_wlan_buff *buff, void *parameter) { struct rt_wlan_info *info = RT_NULL; @@ -871,6 +871,7 @@ static void rt_wlan_join_scan_callback(int event, struct rt_wlan_buff *buff, voi } } } +#endif rt_err_t rt_wlan_connect(const char *ssid, const char *password) { diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index 81e24bd1d2..1309c31fe9 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -1083,7 +1083,6 @@ static int cmd_list(int argc, char **argv) #endif /* RT_USING_DFS */ default: goto _usage; - break; }; return 0; diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 4b1a39e8f8..2f65750b1c 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -797,7 +797,8 @@ static msh_cmd_opt_t *msh_get_cmd_opt(char *opt_str) char *ptr; int len; - if ((ptr = strchr(opt_str, ' '))) + ptr = strchr(opt_str, ' '); + if (ptr) { len = ptr - opt_str; } @@ -892,7 +893,8 @@ void msh_opt_auto_complete(char *prefix) char *opt_str = RT_NULL; msh_cmd_opt_t *opt = RT_NULL; - if ((argc = msh_get_argc(prefix, &opt_str))) + argc = msh_get_argc(prefix, &opt_str); + if (argc) { opt = msh_get_cmd_opt(prefix); }