ASoC: soc-pcm: fix dpcm_path_get error handling
Hello Qiao Zhou,
The patch 8f70e515a8bb: "ASoC: soc-pcm: fix dpcm_path_get error handling" from Sep 10, 2014, leads to the following static checker warning:
sound/soc/soc-compress.c:149 soc_compr_open_fe() error: double unlock 'mutex:&fe->card->mutex'
sound/soc/soc-compress.c
104 ret = dpcm_path_get(fe, stream, &list);
105 if (ret < 0) {
106 mutex_unlock(&fe->card->mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^First unlock.
107 goto fe_err;
108 } else if (ret == 0) {
109 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
110 fe->dai_link->name, stream ? "capture" : "playback");
111 }
112
[ snip ]
140
141 fe_err:
142 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown)
143 fe->dai_link->compr_ops->shutdown(cstream);
144 machine_err:
145 if (platform->driver->compr_ops && platform->driver->compr_ops->free)
146 platform->driver->compr_ops->free(cstream);
147 out:
148 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
149 mutex_unlock(&fe->card->mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Second unlock.
150 return ret;
151 }
regards,
dan carpenter
Hi Dan,
You're right. We should not unlock the mutex here. I'll submit a patch to fix it soon. sorry for the inconvenience.
Best Regards
Qiao
________________________________________
From: Dan Carpenter [[email protected]]
Sent: Thursday, September 11, 2014 6:08 AM
To: Qiao Zhou
Cc: [email protected]
Subject: re: ASoC: soc-pcm: fix dpcm_path_get error handling
Hello Qiao Zhou,
The patch 8f70e515a8bb: "ASoC: soc-pcm: fix dpcm_path_get error handling" from Sep 10, 2014, leads to the following static checker warning:
sound/soc/soc-compress.c:149 soc_compr_open_fe()
error: double unlock 'mutex:&fe->card->mutex'sound/soc/soc-compress.c
104 ret = dpcm_path_get(fe, stream, &list);
105 if (ret < 0) {
106 mutex_unlock(&fe->card->mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^First unlock.
107 goto fe_err;
108 } else if (ret == 0) {
109 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
110 fe->dai_link->name, stream ? "capture" : "playback");
111 }
112
[ snip ]
140
141 fe_err:
142 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown)
143 fe->dai_link->compr_ops->shutdown(cstream);
144 machine_err:
145 if (platform->driver->compr_ops && platform->driver->compr_ops->free)
146 platform->driver->compr_ops->free(cstream);
147 out:
148 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
149 mutex_unlock(&fe->card->mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Second unlock.
150 return ret;
151 }
regards,
dan carpenter