linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAPFB: panel-sony-acx565akm: fix missing mutex unlocks
@ 2013-12-30 16:17 Ivaylo Dimitrov
  2014-01-04 12:51 ` Pavel Machek
  0 siblings, 1 reply; 10+ messages in thread
From: Ivaylo Dimitrov @ 2013-12-30 16:17 UTC (permalink / raw)
  To: tomi.valkeinen
  Cc: plagnioj, pali.rohar, pavel, linux-omap, linux-fbdev,
	linux-kernel, Ivaylo Dimitrov

From: Ivaylo Dimitrov <freemangordon@abv.bg>

Commit c37dd677988ca50bc8bc60ab5ab053720583c168 fixes the unbalanced
unlock in acx565akm_enable but introduces another problem - if
acx565akm_panel_power_on exits early, the mutex is not unlocked. Fix
that by unlocking the mutex on early return. Also add mutex protection in
acx565akm_panel_power_off and remove an unused variable

Signed-off-by: Ivaylo Dimitrov <freemangordon@abv.bg>
---
 .../omap2/displays-new/panel-sony-acx565akm.c      |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c
index d94f35d..a093d3a 100644
--- a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c
@@ -535,6 +535,7 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev)
 
 	r = in->ops.sdi->enable(in);
 	if (r) {
+		mutex_unlock(&ddata->mutex);
 		pr_err("%s sdi enable failed\n", __func__);
 		return r;
 	}
@@ -546,6 +547,7 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev)
 		gpio_set_value(ddata->reset_gpio, 1);
 
 	if (ddata->enabled) {
+		mutex_unlock(&ddata->mutex);
 		dev_dbg(&ddata->spi->dev, "panel already enabled\n");
 		return 0;
 	}
@@ -578,10 +580,14 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev)
 	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	struct omap_dss_device *in = ddata->in;
 
+	mutex_lock(&ddata->mutex);
+
 	dev_dbg(dssdev->dev, "%s\n", __func__);
 
-	if (!ddata->enabled)
+	if (!ddata->enabled) {
+		mutex_unlock(&ddata->mutex);
 		return;
+	}
 
 	set_display_state(ddata, 0);
 	set_sleep_mode(ddata, 1);
@@ -601,11 +607,13 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev)
 	msleep(100);
 
 	in->ops.sdi->disable(in);
+
+	mutex_unlock(&ddata->mutex);
+
 }
 
 static int acx565akm_enable(struct omap_dss_device *dssdev)
 {
-	struct panel_drv_data *ddata = to_panel_data(dssdev);
 	int r;
 
 	dev_dbg(dssdev->dev, "%s\n", __func__);
-- 
1.5.6.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-01-01 12:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-30 16:17 [PATCH] ARM: OMAPFB: panel-sony-acx565akm: fix missing mutex unlocks Ivaylo Dimitrov
2014-01-04 12:51 ` Pavel Machek
2014-01-05 12:58   ` Ivaylo Dimitrov
2014-01-05 13:13     ` [PATCH v2] " Ivaylo Dimitrov
2014-01-10 10:56       ` Tomi Valkeinen
2014-01-11  9:39         ` Ivaylo Dimitrov
2014-01-13 10:20           ` Tomi Valkeinen
2015-12-25 13:29             ` Ivaylo Dimitrov
2015-12-29  7:46               ` Tomi Valkeinen
2016-01-01 12:25                 ` Ivaylo Dimitrov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).