These two error paths need to drop the lock before returning.
Unified · Split
| @@ -1850,8 +1850,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr) · 1849 unmodified lines | ||
| 1850 | 1850 | d_name, |
| 1851 | 1851 | "green", |
| 1852 | 1852 | joycon_player_led_names[i]); |
| 1853 | − if (!name) | |
| 1853 | + if (!name) { | |
| 1854 | + mutex_unlock(&joycon_input_num_mutex); | |
| 1854 | 1855 | return -ENOMEM; |
| 1856 | + } | |
| 1855 | 1857 | |
| 1856 | 1858 | led = &ctlr->leds[i]; |
| 1857 | 1859 | led->name = name; |
| @@ -1864,6 +1866,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr) · 6 unmodified lines | ||
| 1864 | 1866 | ret = devm_led_classdev_register(&hdev->dev, led); |
| 1865 | 1867 | if (ret) { |
| 1866 | 1868 | hid_err(hdev, "Failed registering %s LED\n", led->name); |
| 1869 | + mutex_unlock(&joycon_input_num_mutex); | |
| 1867 | 1870 | return ret; |
| 1868 | 1871 | } |
| 1869 | 1872 | } |