aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2014-06-21 11:57:59 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-06-26 06:48:00 -0400
commitcb6ec182c13fc87a6562d47f18721dbd702adb52 (patch)
treeebc9c1794ea2d12153d1153242a458ebc3794cf9
parenta497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee (diff)
drivers/video/fbdev : dereference without an error test
After a variable is assigned the result of backlight_device_register, an error test should be performed before a dereference. A simplified version of the semantic match that finds this problem is as follows: // <smpl> @def0@ expression x; position p0; @@ x@p0 = backlight_device_register(...) @protected@ expression def0.x,E; position def0.p0; position p; statement S; @@ x@p0 ... when != x = E if (!IS_ERR(x) && ...) {<... x@p ...>} else S @unprotected@ expression def0.x,E; identifier fld; position def0.p0; position p != protected.p; @@ x@p0 ... when != x = E * x@p->fld // </smpl> Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
index c7ba4d8b928a..617f8d2f5127 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
@@ -817,6 +817,10 @@ static int acx565akm_probe(struct spi_device *spi)
817 817
818 bldev = backlight_device_register("acx565akm", &ddata->spi->dev, 818 bldev = backlight_device_register("acx565akm", &ddata->spi->dev,
819 ddata, &acx565akm_bl_ops, &props); 819 ddata, &acx565akm_bl_ops, &props);
820 if (IS_ERR(bldev)) {
821 r = PTR_ERR(bldev);
822 goto err_reg_bl;
823 }
820 ddata->bl_dev = bldev; 824 ddata->bl_dev = bldev;
821 if (ddata->has_cabc) { 825 if (ddata->has_cabc) {
822 r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); 826 r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
@@ -862,6 +866,7 @@ err_reg:
862 sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group); 866 sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group);
863err_sysfs: 867err_sysfs:
864 backlight_device_unregister(bldev); 868 backlight_device_unregister(bldev);
869err_reg_bl:
865err_detect: 870err_detect:
866err_gpio: 871err_gpio:
867 omap_dss_put_device(ddata->in); 872 omap_dss_put_device(ddata->in);