Commit 45fb4f8d81578e0a17c45c4593a3305afbf7a48b
Committed by
Marc Kleine-Budde
1 parent
8646224cdb
Exists in
ti-lsk-linux-4.1.y
and in
12 other branches
can: only rename enabled led triggers when changing the netdev name
Commit a1ef7bd9fce8 ("can: rename LED trigger name on netdev renames") renames the led trigger names according to the changed netdevice name. As not every CAN driver supports and initializes the led triggers, checking for the CAN private datastructure with safe_candev_priv() in the notifier chain is not enough. This patch adds a check when CONFIG_CAN_LEDS is enabled and the driver does not support led triggers. For stable 3.9+ Cc: Fabio Baltieri <fabio.baltieri@gmail.com> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Acked-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be> Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff
drivers/net/can/led.c
... | ... | @@ -97,6 +97,9 @@ |
97 | 97 | if (!priv) |
98 | 98 | return NOTIFY_DONE; |
99 | 99 | |
100 | + if (!priv->tx_led_trig || !priv->rx_led_trig) | |
101 | + return NOTIFY_DONE; | |
102 | + | |
100 | 103 | if (msg == NETDEV_CHANGENAME) { |
101 | 104 | snprintf(name, sizeof(name), "%s-tx", netdev->name); |
102 | 105 | led_trigger_rename_static(name, priv->tx_led_trig); |