History

HID: nintendo: unlock on error in joycon_leds_create()

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

Dan Carpenter committed 5 years ago

Commit 304dd361 parent f155dfe1 file · +4 −1Browse files

Unified · Split

drivers/hid/hid-nintendo.c+4−1
@@ -1850,8 +1850,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr) · 1849 unmodified lines
18501850 d_name,
18511851 "green",
18521852 joycon_player_led_names[i]);
1853− if (!name)
1853+ if (!name) {
1854+ mutex_unlock(&joycon_input_num_mutex);
18541855 return -ENOMEM;
1856+ }
18551857
18561858 led = &ctlr->leds[i];
18571859 led->name = name;
@@ -1864,6 +1866,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr) · 6 unmodified lines
18641866 ret = devm_led_classdev_register(&hdev->dev, led);
18651867 if (ret) {
18661868 hid_err(hdev, "Failed registering %s LED\n", led->name);
1869+ mutex_unlock(&joycon_input_num_mutex);
18671870 return ret;
18681871 }
18691872 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t