From patchwork Sun Jun 12 14:28:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9171525 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 4D44560573 for ; Sun, 12 Jun 2016 14:29:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 312DB21C9A for ; Sun, 12 Jun 2016 14:29:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 239DB264F4; Sun, 12 Jun 2016 14:29:13 +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 AA25B21C9A for ; Sun, 12 Jun 2016 14:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752549AbcFLO3L (ORCPT ); Sun, 12 Jun 2016 10:29:11 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33491 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbcFLO3K (ORCPT ); Sun, 12 Jun 2016 10:29:10 -0400 Received: by mail-wm0-f68.google.com with SMTP id r5so9105681wmr.0; Sun, 12 Jun 2016 07:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=hUEwnbp5bABM1tNdI5i8B6eWIlrWuy6L0rJbBzqfBPM=; b=Lub0va3VMiGm7hVJxjaif0LlfmdjG9UixZKUQRJUvbkjZxiqhVCH0XuEoBKsryJ/zZ XSVXUaq6FXQ/7/bMM5cDBV1sHIYZ0q0JE+slsitjJ48j8/w88NPMaT1hqt+cvZL6sH5+ iqHlG8m62PBornbiadh10rPpL5ETl7tVlGty81W6oHrxhAyY7t6PzqSzx74Dgp4MPF+R UDYgGRLYLSFGAg1qkFYJNgoF+CRUbIk96wwcQ3ANVDRe3UM8+GgSIWLbQiUVP6F6fjvy QqRUHg0Tee+AuekykvweOhAXm4xG7wj1ACO3rPwmbUMjswAAzEV+R5vHZFUKC8nG+zc5 oQqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hUEwnbp5bABM1tNdI5i8B6eWIlrWuy6L0rJbBzqfBPM=; b=gI/RpArruGQ89oe9Yk040Kb2uLaiSbnCN5C2bEUFPaYKpPmElt74ljZ5UHz/B7+ddm Vnap/i9JaAHwoXt2Ytxx/cOFQXgnm8fPgHkE3/8SAx5m8kP9RGohZpKfHI4IXHp6eH/I kis24s8SVkmmVeTteckmYJDQFj2PN2npnnBTdgZtErmJX6WWpzKSt/aWLHBsIWTIiEOR GtHJs9TDrb/xgnAxu2fdVWgrakFGqMHZQWEkQ/7d/K/TpVuUE6Hhmk64BmT729D5emOF ZYzIH1Mx9sSDDH9/WTmhyGN/9lubzKMqG/Em+1QNh0OhUuyYb9CXKf9OydaN/c4Yr51H pvdA== X-Gm-Message-State: ALyK8tLq3E6dZh9eG1DODp8U9khjaldbNpSlizcdNBqVSnljW9ewbhwEC6gCO2foaWinJA== X-Received: by 10.194.134.67 with SMTP id pi3mr10171363wjb.148.1465741748178; Sun, 12 Jun 2016 07:29:08 -0700 (PDT) Received: from sudip-laptop.lan (234.98.208.46.dyn.plus.net. [46.208.98.234]) by smtp.gmail.com with ESMTPSA id r6sm9344417wme.14.2016.06.12.07.29.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Jun 2016 07:29:07 -0700 (PDT) From: Sudip Mukherjee To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] Input: gpio-keys - use devm_add_action_or_reset Date: Sun, 12 Jun 2016 15:28:56 +0100 Message-Id: <1465741736-5166-1-git-send-email-sudipm.mukherjee@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 If devm_add_action() fails we are printing the error message and returning but we have already setup a delayed work or a timer. Lets now use the helper devm_add_action_or_reset() and return and in case of error the cleanup function will be called by the helper to cancel the delayed work or to delete the timer. Signed-off-by: Sudip Mukherjee --- 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..2b1d2e9 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",