From patchwork Mon Dec 30 16:17:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 3420021 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7EE8DC02DC for ; Mon, 30 Dec 2013 16:19:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B201B200EC for ; Mon, 30 Dec 2013 16:19:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4007200E3 for ; Mon, 30 Dec 2013 16:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756018Ab3L3QTi (ORCPT ); Mon, 30 Dec 2013 11:19:38 -0500 Received: from mail-ea0-f182.google.com ([209.85.215.182]:61621 "EHLO mail-ea0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755877Ab3L3QTh (ORCPT ); Mon, 30 Dec 2013 11:19:37 -0500 Received: by mail-ea0-f182.google.com with SMTP id a15so5202631eae.13 for ; Mon, 30 Dec 2013 08:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=mDCGW/jogTOdyWctxkEC6X8f0n9w1KMlUgZKfFvfw/k=; b=A/SZnCsgJd+Pdr4yEEFPcsrz9HyI9JR0XEAaSMPsB+NXa8IE/SMph04Ga/IbadUBJ0 r5CO3x39USxrVVMg8iFP84FaMcBquAwFmDlmOZsV2KhboRPMPkMzMhM80yLThDR+rgT7 F3nrIjRqei9VPuedFiV4dT8BJp+dUwNuYwiRc5CN1DEIY97jFgVji3+NeIkAL2YSABIo AGi87R0hmAli93P2pniCf6NySa9fmr8hcc3Tp8LwlYc+xhpZVQ0+DUv7mi7H4C7gYhUX raNsaaqFrnz7EySG4xYXJ3rzMAk1hTEJWMeatbE7/k4EYUJP1UCjAwWz6zNoicfOvInI JunQ== X-Received: by 10.14.48.74 with SMTP id u50mr574928eeb.107.1388420375943; Mon, 30 Dec 2013 08:19:35 -0800 (PST) Received: from localhost ([46.249.74.23]) by mx.google.com with ESMTPSA id h3sm110024809eem.15.2013.12.30.08.19.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 30 Dec 2013 08:19:35 -0800 (PST) From: Ivaylo Dimitrov To: tomi.valkeinen@ti.com Cc: plagnioj@jcrosoft.com, pali.rohar@gmail.com, pavel@ucw.cz, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivaylo Dimitrov Subject: [PATCH] ARM: OMAPFB: panel-sony-acx565akm: fix missing mutex unlocks Date: Mon, 30 Dec 2013 18:17:52 +0200 Message-Id: <1388420272-5132-1-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.8.4.msysgit.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ivaylo Dimitrov 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 Reviewed-by: Pavel Machek --- .../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__);