From cb6ec182c13fc87a6562d47f18721dbd702adb52 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 21 Jun 2014 21:27:59 +0530 Subject: 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: // @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 // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers') 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 c7ba4d8..617f8d2 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) bldev = backlight_device_register("acx565akm", &ddata->spi->dev, ddata, &acx565akm_bl_ops, &props); + if (IS_ERR(bldev)) { + r = PTR_ERR(bldev); + goto err_reg_bl; + } ddata->bl_dev = bldev; if (ddata->has_cabc) { r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); @@ -862,6 +866,7 @@ err_reg: sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group); err_sysfs: backlight_device_unregister(bldev); +err_reg_bl: err_detect: err_gpio: omap_dss_put_device(ddata->in); -- cgit v1.1 From 21d9ca906370e5b3cbd7f507fd7116bbe8edb877 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Jun 2014 11:05:14 +0300 Subject: OMAPDSS: DISPC: fix debugfs reg dump DISPC reg dump prints a few registers twice. Remove the extra prints. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dispc.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers') diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index 7aa33b0..d1f0dbb 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -3257,13 +3257,10 @@ static void dispc_dump_regs(struct seq_file *s) if (i == OMAP_DSS_CHANNEL_DIGIT) continue; - DUMPREG(i, DISPC_DEFAULT_COLOR); - DUMPREG(i, DISPC_TRANS_COLOR); DUMPREG(i, DISPC_TIMING_H); DUMPREG(i, DISPC_TIMING_V); DUMPREG(i, DISPC_POL_FREQ); DUMPREG(i, DISPC_DIVISORo); - DUMPREG(i, DISPC_SIZE_MGR); DUMPREG(i, DISPC_DATA_CYCLE1); DUMPREG(i, DISPC_DATA_CYCLE2); -- cgit v1.1 From beb8384d4a67179e8c207f00e9035ab121ed5940 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Jun 2014 11:35:10 +0300 Subject: OMAPDSS: DISPC: reject interlace for lcd out OMAP2/3 does not support interlace for LCD out. OMAP4+ does, but is not supported by the driver at the moment. The driver still accepts interlaced mode for LCD out, causing broken display output. This patch makes dispc reject interlace for LCD out. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dispc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index d1f0dbb..37373b6 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -2886,6 +2886,9 @@ bool dispc_mgr_timings_ok(enum omap_channel channel, timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock); if (dss_mgr_is_lcd(channel)) { + /* TODO: OMAP4+ supports interlace for LCD outputs */ + timings_ok &= timings->interlace == false; + timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp, timings->hbp, timings->vsw, timings->vfp, timings->vbp); -- cgit v1.1 From eadd33bb95e0ab5e3f443bcd9ca45af4010110c8 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Jun 2014 11:36:08 +0300 Subject: OMAPDSS: DISPC: clean up dispc_mgr_timings_ok dispc_mgr_timings_ok() is a bit confusing how it handles the return value. Change the function to just return immediately when a timing is deemed not valid, making the code much easier to follow. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dispc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index 37373b6..be053aa 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -2879,22 +2879,24 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel, bool dispc_mgr_timings_ok(enum omap_channel channel, const struct omap_video_timings *timings) { - bool timings_ok; - - timings_ok = _dispc_mgr_size_ok(timings->x_res, timings->y_res); + if (!_dispc_mgr_size_ok(timings->x_res, timings->y_res)) + return false; - timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock); + if (!_dispc_mgr_pclk_ok(channel, timings->pixelclock)) + return false; if (dss_mgr_is_lcd(channel)) { /* TODO: OMAP4+ supports interlace for LCD outputs */ - timings_ok &= timings->interlace == false; + if (timings->interlace) + return false; - timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp, + if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp, timings->hbp, timings->vsw, timings->vfp, - timings->vbp); + timings->vbp)) + return false; } - return timings_ok; + return true; } static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw, -- cgit v1.1 From d27d20c88da7d78b389e5e824aff0cdfc9ce203f Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 9 Jun 2014 13:08:02 +0300 Subject: OMAPDSS: HDMI: fix name conflict OMAP HDMI driver has an 'enum hdmi_audio_sample_size', which conflicts with the common include/linux/hdmi.h. Change the name of the OMAP specific enum with '_omap" postfix. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/hdmi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index fbee078..1a62dc3 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -142,7 +142,7 @@ enum hdmi_audio_samples_perword { HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1 }; -enum hdmi_audio_sample_size { +enum hdmi_audio_sample_size_omap { HDMI_AUDIO_SAMPLE_16BITS = 0, HDMI_AUDIO_SAMPLE_24BITS = 1 }; @@ -260,7 +260,7 @@ struct hdmi_audio_format { enum hdmi_audio_justify justification; enum hdmi_audio_sample_order sample_order; enum hdmi_audio_samples_perword samples_per_word; - enum hdmi_audio_sample_size sample_size; + enum hdmi_audio_sample_size_omap sample_size; enum hdmi_audio_blk_strt_end_sig en_sig_blk_strt_end; }; -- cgit v1.1 From 89a2d6183bbd87431fccf9f57a7fec7ae38843e1 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 9 Jun 2014 15:29:42 +0300 Subject: OMAPDSS: Kconfig: select HDMI Select HDMI support to be able to use HDMI infoframe helpers. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/video/fbdev/omap2/dss/Kconfig b/drivers/video/fbdev/omap2/dss/Kconfig index 285bcd1..3d5eb6c 100644 --- a/drivers/video/fbdev/omap2/dss/Kconfig +++ b/drivers/video/fbdev/omap2/dss/Kconfig @@ -5,6 +5,7 @@ menuconfig OMAP2_DSS tristate "OMAP2+ Display Subsystem support" select VIDEOMODE_HELPERS select OMAP2_DSS_INIT + select HDMI help OMAP2+ Display Subsystem support. -- cgit v1.1 From db85ca7ca51ca886e8cd127368e09a7955bb041c Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 9 Jun 2014 13:09:00 +0300 Subject: OMAPDSS: HDMI4: use common AVI infoframe support Instead of using OMAP specific AVI infoframe structs, use the common one from include/linux/hdmi.h. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/hdmi.h | 2 + drivers/video/fbdev/omap2/dss/hdmi4_core.c | 136 ++++++----------------------- drivers/video/fbdev/omap2/dss/hdmi4_core.h | 1 + 3 files changed, 28 insertions(+), 111 deletions(-) (limited to 'drivers') diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index 1a62dc3..6cd4a75 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -22,6 +22,7 @@ #include #include #include +#include #include