From patchwork Mon Mar 7 19:53:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 8522751 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 59CE19F8A8 for ; Mon, 7 Mar 2016 19:53:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 831FA201FE for ; Mon, 7 Mar 2016 19:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9EA5C201EF for ; Mon, 7 Mar 2016 19:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932081AbcCGTxv (ORCPT ); Mon, 7 Mar 2016 14:53:51 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:40764 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932113AbcCGTxu (ORCPT ); Mon, 7 Mar 2016 14:53:50 -0500 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1ad1Dw-0002vf-0P; Mon, 07 Mar 2016 20:53:48 +0100 Received: from ukl by dude.hi.pengutronix.de with local (Exim 4.86) (envelope-from ) id 1ad1Dv-0005HV-Or; Mon, 07 Mar 2016 20:53:47 +0100 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: kernel@pengutronix.de, Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] video: fbdev: imxfb: add some error handling Date: Mon, 7 Mar 2016 20:53:45 +0100 Message-Id: <1457380425-20244-4-git-send-email-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457380425-20244-1-git-send-email-u.kleine-koenig@pengutronix.de> References: <1457380425-20244-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-fbdev@vger.kernel.org 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, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Signed-off-by: Uwe Kleine-König Reviewed-by: Philipp Zabel --- drivers/video/fbdev/imxfb.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index 3dd2824e6773..671b3719db56 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -473,8 +473,9 @@ static int imxfb_set_par(struct fb_info *info) return 0; } -static void imxfb_enable_controller(struct imxfb_info *fbi) +static int imxfb_enable_controller(struct imxfb_info *fbi) { + int ret; if (fbi->enabled) return; @@ -496,10 +497,27 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) */ writel(RMCR_LCDC_EN_MX1, fbi->regs + LCDC_RMCR); - clk_prepare_enable(fbi->clk_ipg); - clk_prepare_enable(fbi->clk_ahb); - clk_prepare_enable(fbi->clk_per); + ret = clk_prepare_enable(fbi->clk_ipg); + if (ret) + goto err_enable_ipg; + + ret = clk_prepare_enable(fbi->clk_ahb); + if (ret) + goto err_enable_ahb; + + ret = clk_prepare_enable(fbi->clk_per); + if (ret) { + clk_disable_unprepare(fbi->clk_ahb); +err_enable_ahb: + clk_disable_unprepare(fbi->clk_ipg); +err_enable_ipg: + writel(0, fbi->regs + LCDC_RMCR); + + return ret; + } + fbi->enabled = true; + return 0; } static void imxfb_disable_controller(struct imxfb_info *fbi) @@ -510,8 +528,8 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) pr_debug("Disabling LCD controller\n"); clk_disable_unprepare(fbi->clk_per); - clk_disable_unprepare(fbi->clk_ipg); clk_disable_unprepare(fbi->clk_ahb); + clk_disable_unprepare(fbi->clk_ipg); fbi->enabled = false; writel(0, fbi->regs + LCDC_RMCR); @@ -520,6 +538,7 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) static int imxfb_blank(int blank, struct fb_info *info) { struct imxfb_info *fbi = info->par; + int ret = 0;; pr_debug("imxfb_blank: blank=%d\n", blank); @@ -532,10 +551,10 @@ static int imxfb_blank(int blank, struct fb_info *info) break; case FB_BLANK_UNBLANK: - imxfb_enable_controller(fbi); + ret = imxfb_enable_controller(fbi); break; } - return 0; + return ret; } static struct fb_ops imxfb_ops = {