summaryrefslogtreecommitdiff
path: root/linux/Documentation/video4linux/cx88
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-12-02 22:34:52 +0000
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-02 22:34:52 +0000
commit5be2df264845a545c345c924c23153459140a308 (patch)
tree549e8edccd18312634f01edefba675943145a0e9 /linux/Documentation/video4linux/cx88
parent127fb1f48bed6f38a5a9ad79344a821673bcad7a (diff)
downloadmediapointer-dvb-s2-5be2df264845a545c345c924c23153459140a308.tar.gz
mediapointer-dvb-s2-5be2df264845a545c345c924c23153459140a308.tar.bz2
drivers/media/video/cx88/cx88-alsa.c: Adjust error-handling code
From: Julia Lawall <julia@diku.dk> In the function cx88_audio_initdev, the value card has been created using snd_card_new. The other error handling code in this function frees the value using snd_card_free. I have thus changed the first error case to do the same. On the other hand, it may be that card is not sufficiently initialized at this point to use snd_card_free, in which case something else should be done to free the memory in the error case. In the function snd_cx88_create the call kfree(chip) in one error case looks suspicious, both because it is not done in the other error code, and because chip points into the middle of the memory allocated by snd_card_new, ie it is not itself associated with a separate kmalloc. Therefore I have removed it. The semantic match that finds the first problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r exists@ local idexpression x; statement S,S1; position p1,p2,p3; expression E,E1; type T,T1; expression *ptr != NULL; @@ ( if ((x@p1 = snd_card_new(...)) == NULL) S | x@p1 = snd_card_new(...); ) ... when != snd_card_free(...,(T)x,...) when != if (...) { <+... snd_card_free(...,(T)x,...) ...+> } when != true x == NULL || ... when != x = E when != E = (T)x when any ( if (x == NULL || ...) S1 | if@p2 (...) { ... when != snd_card_free(...,(T1)x,...) when != if (...) { <+... snd_card_free(...,(T1)x,...) ...+> } when != x = E1 when != E1 = (T1)x ( return \(0\|<+...x...+>\|ptr\); | return@p3 ...; ) } ) @ script:python @ p1 << r.p1; p3 << r.p3; @@ print "* file: %s snd_card_new: %s return: %s" % (p1[0].file,p1[0].line,p3[0].line) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/Documentation/video4linux/cx88')
0 files changed, 0 insertions, 0 deletions