From patchwork Tue Aug 1 10:04:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9874039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2E5B46038F for ; Tue, 1 Aug 2017 10:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11828285E4 for ; Tue, 1 Aug 2017 10:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0629A2869C; Tue, 1 Aug 2017 10:04:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A043A285E4 for ; Tue, 1 Aug 2017 10:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751496AbdHAKEZ (ORCPT ); Tue, 1 Aug 2017 06:04:25 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36071 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750852AbdHAKEZ (ORCPT ); Tue, 1 Aug 2017 06:04:25 -0400 Received: by mail-pf0-f196.google.com with SMTP id t83so1773556pfj.3; Tue, 01 Aug 2017 03:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M/dkC8RG8ECqRF7VwZMZgEtnqPHbdNuYiICucdZAth8=; b=nH/rION/MbvpgXLImCkmI9n1Jwgg54WXvYR0j7KKyL+qlWtK+rsmz9+fiqwB3jeuqG mSMpznqkT/YdEbIKJTRT1uEYpb8CvcwL16DH7sf7hmD9ZS/bAlXb1F2vWym4GjK89mSL 7qeDGO3KiEkarYxDpt6V6j8KSI6yzChGEEfhR1gWlDRyn/pxUCp68b9UTx0UqNxE4XLb yHtT7z2mMei/iO7GJyQrKhF7U4HUAlA7Ov0JHDZ0mzyzt1ke3Lx0wwtuGsMirA5paMSo RADb9Z6t12Zl7q2FGG/WgF7nlq0iirJwuJWxwKssZqWgaFFqZU+W/YDSDP7Dpe6LEXHa QMQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M/dkC8RG8ECqRF7VwZMZgEtnqPHbdNuYiICucdZAth8=; b=Vr8LfjgSa4dS5qRuTFVlr2fQb8BFi8OJys6OiQpcgtm15ByBJkC1YiVSV3Mr/oFFnY ZEaU4QQ9Td/A3tN262ytp4z5BouQnjBwwENJrgiRuwPowd8+/YmTc3/IkinHUooMsHcF mFWZs4707K89oMHn3K9X1fLXJaCexbdUOe4xU+F+prdXiEsMwyXUejtQzmX+hypGIcEF cHeWjmwLUJUtWJsSaMz36QABvyJrVB+mRUzemfjyrZHyPHbiMAziYMXmxP1g5MKvr/ud eq76hlgn6FVvLJl+gZWFWNaTmyC7PCmiTWJg61paLqiCXYVDGmH6YNiXN3jr46cXSzcj 1puA== X-Gm-Message-State: AIVw110TWViaA0ZMAudrNGMa9psxPsLwH2wMz6Jvf652z4gXfKtl2tOv PbNTGXFhBSly1A== X-Received: by 10.84.132.73 with SMTP id 67mr19935373ple.53.1501581864660; Tue, 01 Aug 2017 03:04:24 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id b9sm32912936pfl.13.2017.08.01.03.04.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 03:04:24 -0700 (PDT) From: Arvind Yadav To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] Input: pxa27x_keypad: Handle return value of clk_prepare_enable. Date: Tue, 1 Aug 2017 15:34:10 +0530 Message-Id: <462d2ba4a19174ca1af9efe74f57fd815c0034d1.1501581502.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/input/keyboard/pxa27x_keypad.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 3841fa3..a3396a7 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c @@ -644,9 +644,12 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) static int pxa27x_keypad_open(struct input_dev *dev) { struct pxa27x_keypad *keypad = input_get_drvdata(dev); - + int ret; /* Enable unit clock */ - clk_prepare_enable(keypad->clk); + ret = clk_prepare_enable(keypad->clk); + if (ret) + return ret; + pxa27x_keypad_config(keypad); return 0; @@ -683,6 +686,7 @@ static int pxa27x_keypad_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); struct input_dev *input_dev = keypad->input_dev; + int ret; /* * If the keypad is used as wake up source, the clock is not turned @@ -695,7 +699,11 @@ static int pxa27x_keypad_resume(struct device *dev) if (input_dev->users) { /* Enable unit clock */ - clk_prepare_enable(keypad->clk); + ret = clk_prepare_enable(keypad->clk); + if (ret) { + mutex_unlock(&input_dev->mutex); + return ret; + } pxa27x_keypad_config(keypad); }