From: Julia Lawall Date: Sat, 17 Oct 2009 06:33:47 +0000 (+0200) Subject: ALSA: sound/parisc: Move dereference after NULL test X-Git-Tag: v2.6.32-rc6~14^2~8 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8e0929d7290cab7c5b1a3e5f5f54f73daf38038;p=pandora-kernel.git ALSA: sound/parisc: Move dereference after NULL test If the NULL test on h is needed in snd_harmony_mixer_init, then the dereference should be after the NULL test. Actually, there is a sequence of calls: snd_harmony_create, then snd_harmony_pcm_init, and then snd_harmony_mixer_init. snd_harmony_create initializes h, but may indeed leave it as NULL. There was no NULL test at the beginning of snd_harmony_pcm_init, so I have added one. The NULL test in snd_harmony_mixer_init is then not necessary, but in case the ordering of the calls changes, I have left it, and moved the dereference after it. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // Signed-off-by: Julia Lawall Signed-off-by: Takashi Iwai --- Reading git-diff-tree failed