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
1850 d_name,1850 d_name,
1851 "green",1851 "green",
1852 joycon_player_led_names[i]);1852 joycon_player_led_names[i]);
1853 if (!name)1853 if (!name) {
1854 mutex_unlock(&joycon_input_num_mutex);
1854 return -ENOMEM;1855 return -ENOMEM;
1856 }
1855 1857
1856 led = &ctlr->leds[i];1858 led = &ctlr->leds[i];
1857 led->name = name;1859 led->name = name;
@@ -1864,6 +1866,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr) · 6 unmodified lines
1864 ret = devm_led_classdev_register(&hdev->dev, led);1866 ret = devm_led_classdev_register(&hdev->dev, led);
1865 if (ret) {1867 if (ret) {
1866 hid_err(hdev, "Failed registering %s LED\n", led->name);1868 hid_err(hdev, "Failed registering %s LED\n", led->name);
1869 mutex_unlock(&joycon_input_num_mutex);
1867 return ret;1870 return ret;
1868 }1871 }
1869 }1872 }

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