From patchwork Tue Jul 5 16:18:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9214833 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 DE0A26048B for ; Tue, 5 Jul 2016 16:28:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE37C2756B for ; Tue, 5 Jul 2016 16:28:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1D14275A2; Tue, 5 Jul 2016 16:28:40 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB 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 C013F2756B for ; Tue, 5 Jul 2016 16:28:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752969AbcGEQ2h (ORCPT ); Tue, 5 Jul 2016 12:28:37 -0400 Received: from 51.16-broadband.acttv.in ([106.51.16.38]:9284 "EHLO arvind-ThinkPad-Edge-E431" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752524AbcGEQ2h (ORCPT ); Tue, 5 Jul 2016 12:28:37 -0400 X-Greylist: delayed 602 seconds by postgrey-1.27 at vger.kernel.org; Tue, 05 Jul 2016 12:28:36 EDT Received: by arvind-ThinkPad-Edge-E431 (Postfix, from userid 1000) id 257C54E0E83; Tue, 5 Jul 2016 21:48:25 +0530 (IST) From: Arvind Yadav To: dmitry.torokhov@gmail.com Cc: ldewangan@nvidia.com, linus.walleij@linaro.org, van.freenix@gmail.com, bjorn.andersson@sonymobile.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Arvind Yadav Subject: [PATCH] GPIO_KEYS: If devm_add_action() fails, we are explicitly calling the cleanup to freethe resources allocated. Use the helper devm_add_action_or_reset() and return directly in case of error, since the cleanup function has been already called by the helper if there was any error. Date: Tue, 5 Jul 2016 21:48:20 +0530 Message-Id: <1467735500-5033-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 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 Signed-off-by: Arvind Yadav --- drivers/input/keyboard/gpio_keys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 2909365..a2fa3bb 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -542,7 +542,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev, * Install custom action to cancel release timer and * workqueue item. */ - error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata); + error = devm_add_action_or_reset(&pdev->dev, gpio_keys_quiesce_key, + bdata); if (error) { dev_err(&pdev->dev, "failed to register quiesce action, error: %d\n",