leds: trigger: netdev: uninitialized variable in netdev_trig_activate()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 14 Jun 2023 07:03:59 +0000 (10:03 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 Jun 2023 10:46:43 +0000 (11:46 +0100)
The qca8k_cled_hw_control_get() function which implements ->hw_control_get
sets the appropriate bits but does not clear them.  This leads to an
uninitialized variable bug.  Fix this by setting mode to zero at the
start.

Fixes: e0256648c831 ("net: dsa: qca8k: implement hw_control ops")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/leds/trigger/ledtrig-netdev.c

index b0a6f274955200cf49974053b1ee4e7c65d9f364..2311dae7f070ad6b7fe4a9168ce249ee80561f34 100644 (file)
@@ -445,7 +445,7 @@ static void netdev_trig_work(struct work_struct *work)
 static int netdev_trig_activate(struct led_classdev *led_cdev)
 {
        struct led_netdev_data *trigger_data;
-       unsigned long mode;
+       unsigned long mode = 0;
        struct device *dev;
        int rc;