提交 4f066173 编写于 作者: J Julia Lawall 提交者: Mark Brown

ASoC: Move dereference after NULL test

If the NULL test on jack is needed, then the derefernce should be after the
NULL test.

A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):

// <smpl>
@match exists@
expression x, E;
identifier fld;
@@

* x->fld
  ... when != \(x = E\|&x\)
* x == NULL
// </smpl>
Signed-off-by: NJulia Lawall <julia@diku.dk>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 8d567b6b
......@@ -58,7 +58,7 @@ EXPORT_SYMBOL_GPL(snd_soc_jack_new);
*/
void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
{
struct snd_soc_codec *codec = jack->card->codec;
struct snd_soc_codec *codec;
struct snd_soc_jack_pin *pin;
int enable;
int oldstatus;
......@@ -67,6 +67,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
WARN_ON_ONCE(!jack);
return;
}
codec = jack->card->codec;
mutex_lock(&codec->mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册