summaryrefslogtreecommitdiff
path: root/drivers/net/phy/phy_led_triggers.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-03-09 10:03:22 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-03-09 10:03:22 -0800
commit7b179e251ba089898b4e8e6d065be8ae2c0a4a3e (patch)
treed8c5fe6a2d5330da4d7e53e8b85c1540e1fa404a /drivers/net/phy/phy_led_triggers.c
parenta01cd17000a4eb35060666f181f1d46832b59030 (diff)
parentfabeb165afd52a3fb05b9b68e5a3550609b8e157 (diff)
Merge branch 'ib/4.10-sparse-keymap-managed' into next
This brings in version of sparse keymap code that uses managed memory.
Diffstat (limited to 'drivers/net/phy/phy_led_triggers.c')
-rw-r--r--drivers/net/phy/phy_led_triggers.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/phy/phy_led_triggers.c b/drivers/net/phy/phy_led_triggers.c
index fa62bdf2f526..94ca42e630bb 100644
--- a/drivers/net/phy/phy_led_triggers.c
+++ b/drivers/net/phy/phy_led_triggers.c
@@ -12,6 +12,7 @@
*/
#include <linux/leds.h>
#include <linux/phy.h>
+#include <linux/phy_led_triggers.h>
#include <linux/netdevice.h>
static struct phy_led_trigger *phy_speed_to_led_trigger(struct phy_device *phy,
@@ -102,8 +103,10 @@ int phy_led_triggers_register(struct phy_device *phy)
sizeof(struct phy_led_trigger) *
phy->phy_num_led_triggers,
GFP_KERNEL);
- if (!phy->phy_led_triggers)
- return -ENOMEM;
+ if (!phy->phy_led_triggers) {
+ err = -ENOMEM;
+ goto out_clear;
+ }
for (i = 0; i < phy->phy_num_led_triggers; i++) {
err = phy_led_trigger_register(phy, &phy->phy_led_triggers[i],
@@ -120,6 +123,8 @@ out_unreg:
while (i--)
phy_led_trigger_unregister(&phy->phy_led_triggers[i]);
devm_kfree(&phy->mdio.dev, phy->phy_led_triggers);
+out_clear:
+ phy->phy_num_led_triggers = 0;
return err;
}
EXPORT_SYMBOL_GPL(phy_led_triggers_register);