]> Git Repo - linux.git/commitdiff
ALSA: ice1712: Do not left ice->gpio_mutex locked in aureon_add_controls()
authorDmitry Fomin <[email protected]>
Sat, 25 Feb 2023 18:43:21 +0000 (21:43 +0300)
committerTakashi Iwai <[email protected]>
Fri, 3 Mar 2023 13:29:18 +0000 (14:29 +0100)
If snd_ctl_add() fails in aureon_add_controls(), it immediately returns
and leaves ice->gpio_mutex locked. ice->gpio_mutex locks in
snd_ice1712_save_gpio_status and unlocks in
snd_ice1712_restore_gpio_status(ice).

It seems that the mutex is required only for aureon_cs8415_get(),
so snd_ice1712_restore_gpio_status(ice) can be placed
just after that. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Dmitry Fomin <[email protected]>
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
sound/pci/ice1712/aureon.c

index 9a30f6d35d1358e31282002bc07d2d276b3c65e1..40a0e0095030179c7ccb642672d34990f4ab9b02 100644 (file)
@@ -1892,6 +1892,7 @@ static int aureon_add_controls(struct snd_ice1712 *ice)
                unsigned char id;
                snd_ice1712_save_gpio_status(ice);
                id = aureon_cs8415_get(ice, CS8415_ID);
+               snd_ice1712_restore_gpio_status(ice);
                if (id != 0x41)
                        dev_info(ice->card->dev,
                                 "No CS8415 chip. Skipping CS8415 controls.\n");
@@ -1909,7 +1910,6 @@ static int aureon_add_controls(struct snd_ice1712 *ice)
                                        kctl->id.device = ice->pcm->device;
                        }
                }
-               snd_ice1712_restore_gpio_status(ice);
        }
 
        return 0;
This page took 0.0534790000000001 seconds and 4 git commands to generate.