aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/davinci
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2011-10-28 18:58:17 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-07 10:13:15 -0500
commit49a0513c1fca2c43b14416f3f40220fa01ab5e39 (patch)
tree8ef2abeddaf3dd32b6e7156411d9bea80a07f92b /drivers/media/video/davinci
parent0a4524d726cd4d109c57fc194a55ff0a9e4df0e9 (diff)
[media] drivers/media/video/davinci/vpbe_display.c: eliminate a null pointer dereference
In the original code, probe_out could be reached when res was null and then when the irq had not yet been requested. In those cases, the call to free_irq is not needed, so move probe_out down and introduce a new label for the case where calling free_irq is useful. The semantic match that finds this problem is as follows: // <smpl> @r@ expression E, E1; identifier f; statement S1,S2,S3; @@ if (E == NULL) { ... when != if (E == NULL || ...) S1 else S2 when != E = E1 *E->f ... when any return ...; } else S3 // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/davinci')
-rw-r--r--drivers/media/video/davinci/vpbe_display.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/video/davinci/vpbe_display.c b/drivers/media/video/davinci/vpbe_display.c
index 8588a86d9b45..d98da4bfb256 100644
--- a/drivers/media/video/davinci/vpbe_display.c
+++ b/drivers/media/video/davinci/vpbe_display.c
@@ -1746,15 +1746,16 @@ static __devinit int vpbe_display_probe(struct platform_device *pdev)
1746 for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { 1746 for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {
1747 if (register_device(disp_dev->dev[i], disp_dev, pdev)) { 1747 if (register_device(disp_dev->dev[i], disp_dev, pdev)) {
1748 err = -ENODEV; 1748 err = -ENODEV;
1749 goto probe_out; 1749 goto probe_out_irq;
1750 } 1750 }
1751 } 1751 }
1752 1752
1753 printk(KERN_DEBUG "Successfully completed the probing of vpbe v4l2 device\n"); 1753 printk(KERN_DEBUG "Successfully completed the probing of vpbe v4l2 device\n");
1754 return 0; 1754 return 0;
1755 1755
1756probe_out: 1756probe_out_irq:
1757 free_irq(res->start, disp_dev); 1757 free_irq(res->start, disp_dev);
1758probe_out:
1758 for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) { 1759 for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) {
1759 /* Get the pointer to the layer object */ 1760 /* Get the pointer to the layer object */
1760 vpbe_display_layer = disp_dev->dev[k]; 1761 vpbe_display_layer = disp_dev->dev[k];