OSDN Git Service

ASoC: msm8998: fix typo and add check before freeing gpio
authorwloot <wlootlxt123@gmail.com>
Thu, 11 Jul 2019 18:18:59 +0000 (02:18 +0800)
committerArian <arian.kulmer@web.de>
Tue, 19 Nov 2019 15:24:39 +0000 (16:24 +0100)
Change-Id: I46093ec856e5c4d8c7663879d8a3f17f62a46506

sound/soc/msm/msm8998.c

index 103bd8a..c2d3b80 100644 (file)
@@ -9667,11 +9667,14 @@ static int msm_asoc_machine_remove(struct platform_device *pdev)
 
        if (pdata->us_p_power)
                regulator_put(pdata->us_p_power);
-       if (pdata->us_p_power)
+       if (pdata->us_n_power)
                regulator_put(pdata->us_n_power);
 #endif
 
-       gpio_free(pdata->us_euro_gpio);
+       if (pdata->us_euro_gpio > 0) {
+               gpio_free(pdata->us_euro_gpio);
+               pdata->us_euro_gpio = 0;
+       }
        i2s_auxpcm_deinit();
 
        snd_soc_unregister_card(card);