[openwrt/openwrt] realtek: 5.15: fix uninizialized variable in rtl83xx qos driver

LEDE Commits lede-commits at lists.infradead.org
Thu May 11 18:25:04 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/8aa786d9a78a7c4422043206ece21f47e01529e6

commit 8aa786d9a78a7c4422043206ece21f47e01529e6
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Sun May 7 09:57:01 2023 +0200

    realtek: 5.15: fix uninizialized variable in rtl83xx qos driver
    
    Fix uninizialized variable in rtl83xx qos driver
    Fix compilation error:
    drivers/net/dsa/rtl83xx/qos.c: In function 'rtl838x_setup_prio2queue_matrix':
    drivers/net/dsa/rtl83xx/qos.c:298:19: error: 'v' is used uninitialized [-Werror=uninitialized]
      298 |                 v |= i << (min_queues[i] * 3);
          |                 ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/net/dsa/rtl83xx/qos.c:294:13: note: 'v' was declared here
      294 |         u32 v;
          |             ^
    drivers/net/dsa/rtl83xx/qos.c: In function 'rtl83xx_setup_prio2queue_cpu_matrix':
    drivers/net/dsa/rtl83xx/qos.c:320:19: error: 'v' is used uninitialized [-Werror=uninitialized]
      320 |                 v |= max_queues[i] << (i * 3);
          |                 ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/net/dsa/rtl83xx/qos.c:316:13: note: 'v' was declared here
      316 |         u32 v;
          |             ^
    cc1: all warnings being treated as errors
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/qos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/qos.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/qos.c
index 28976412aa..d101e1c97e 100644
--- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/qos.c
+++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/qos.c
@@ -291,7 +291,7 @@ static void rtl839x_rate_control_init(struct rtl838x_switch_priv *priv)
 
 void rtl838x_setup_prio2queue_matrix(int *min_queues)
 {
-	u32 v;
+	u32 v = 0;
 
 	pr_info("Current Intprio2queue setting: %08x\n", sw_r32(RTL838X_QM_INTPRI2QID_CTRL));
 	for (int i = 0; i < MAX_PRIOS; i++)
@@ -313,7 +313,7 @@ void rtl83xx_setup_prio2queue_cpu_matrix(int *max_queues)
 {
 	int reg = soc_info.family == RTL8380_FAMILY_ID ? RTL838X_QM_PKT2CPU_INTPRI_MAP
 					: RTL839X_QM_PKT2CPU_INTPRI_MAP;
-	u32 v;
+	u32 v = 0;
 
 	pr_info("QM_PKT2CPU_INTPRI_MAP: %08x\n", sw_r32(reg));
 	for (int i = 0; i < MAX_PRIOS; i++)




More information about the lede-commits mailing list