From patchwork Fri Jul 6 17:41:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 1166801 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A0BD83FC33 for ; Fri, 6 Jul 2012 17:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758057Ab2GFRmp (ORCPT ); Fri, 6 Jul 2012 13:42:45 -0400 Received: from db3ehsobe004.messaging.microsoft.com ([213.199.154.142]:23660 "EHLO db3outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758056Ab2GFRmp (ORCPT ); Fri, 6 Jul 2012 13:42:45 -0400 Received: from mail81-db3-R.bigfish.com (10.3.81.226) by DB3EHSOBE005.bigfish.com (10.3.84.25) with Microsoft SMTP Server id 14.1.225.23; Fri, 6 Jul 2012 17:40:35 +0000 Received: from mail81-db3 (localhost [127.0.0.1]) by mail81-db3-R.bigfish.com (Postfix) with ESMTP id 4C9482E05A5; Fri, 6 Jul 2012 17:40:34 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839hd24he5bhf0ah107ah) Received: from mail81-db3 (localhost.localdomain [127.0.0.1]) by mail81-db3 (MessageSwitch) id 1341596412369329_23109; Fri, 6 Jul 2012 17:40:12 +0000 (UTC) Received: from DB3EHSMHS019.bigfish.com (unknown [10.3.81.253]) by mail81-db3.bigfish.com (Postfix) with ESMTP id D987C120168; Fri, 6 Jul 2012 17:40:04 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS019.bigfish.com (10.3.87.119) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 6 Jul 2012 17:40:03 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.2.298.5; Fri, 6 Jul 2012 12:41:58 -0500 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.240.144]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q66HfrAj019135; Fri, 6 Jul 2012 10:41:57 -0700 From: Fabio Estevam To: CC: , , Fabio Estevam Subject: [PATCH v2 3/3] keyboard: imx_keypad: Check error returned by clk_prepare_enable() Date: Fri, 6 Jul 2012 14:41:54 -0300 Message-ID: <1341596514-15972-3-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1341596514-15972-1-git-send-email-fabio.estevam@freescale.com> References: <1341596514-15972-1-git-send-email-fabio.estevam@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Check error returned by clk_prepare_enable(). Signed-off-by: Fabio Estevam --- drivers/input/keyboard/imx_keypad.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 4830615..bdb8ee7 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -385,13 +385,17 @@ static int imx_keypad_open(struct input_dev *dev) { struct imx_keypad *keypad = input_get_drvdata(dev); + int ret; dev_dbg(&dev->dev, ">%s\n", __func__); /* We became active from now */ keypad->enabled = true; /* Enable the kpp clock */ - clk_prepare_enable(keypad->clk); + ret = clk_prepare_enable(keypad->clk); + if (ret) + return ret; + imx_keypad_config(keypad); /* Sanity control, not all the rows must be actived now. */ @@ -596,18 +600,23 @@ static int imx_kbd_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct imx_keypad *kbd = platform_get_drvdata(pdev); struct input_dev *input_dev = kbd->input_dev; + int ret = 0; if (device_may_wakeup(&pdev->dev)) disable_irq_wake(kbd->irq); mutex_lock(&input_dev->mutex); - if (input_dev->users) - clk_prepare_enable(kbd->clk); + if (input_dev->users) { + ret = clk_prepare_enable(kbd->clk); + if (ret) + goto err_clk; + } +err_clk: mutex_unlock(&input_dev->mutex); - return 0; + return ret; } #endif