Commit 304dd368 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jiri Kosina

HID: nintendo: unlock on error in joycon_leds_create()

These two error paths need to drop the lock before returning.

Fixes: c5e62676 ("HID: nintendo: add player led support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent f155dfea
......@@ -1850,8 +1850,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
d_name,
"green",
joycon_player_led_names[i]);
if (!name)
if (!name) {
mutex_unlock(&joycon_input_num_mutex);
return -ENOMEM;
}
led = &ctlr->leds[i];
led->name = name;
......@@ -1864,6 +1866,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
ret = devm_led_classdev_register(&hdev->dev, led);
if (ret) {
hid_err(hdev, "Failed registering %s LED\n", led->name);
mutex_unlock(&joycon_input_num_mutex);
return ret;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment