From patchwork Sun Jun 12 14:34:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9171529 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 50B7560573 for ; Sun, 12 Jun 2016 14:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DD2B20410 for ; Sun, 12 Jun 2016 14:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 322FB264F4; Sun, 12 Jun 2016 14:34:50 +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 BED8320410 for ; Sun, 12 Jun 2016 14:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932525AbcFLOea (ORCPT ); Sun, 12 Jun 2016 10:34:30 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34765 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932521AbcFLOe3 (ORCPT ); Sun, 12 Jun 2016 10:34:29 -0400 Received: by mail-wm0-f68.google.com with SMTP id n184so9122128wmn.1; Sun, 12 Jun 2016 07:34:28 -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=rGVGilXjG4pPCuMSQi6UHjMmBDlevmCkR8lJXBRqqRo=; b=JPsnEVcDcIw1oZM01trbvdlPVbwJ/NpQk/KqUVJIG8ZwISSzfQXMYq4ho+NENNke3d djjtWYKuEh9crg/LtyV57HzFDYYpSz5ZJyOZAh6OQzWakd3vmDcIDbDM0jYct5YpLfdh JzCBICCWmUoidAqj80krkACecC/6Sj+4pT9klJKWaxm0DB/obdip04Qcv3fAymLyGKHR eRamCoFhgqy0HNOIBWU7cUqVHk3DF2A5MNG2brNngyRIrDZewcrw3wwHgqCQF4gUkb6o MNqtk/kBfqkZwZ46+MH0FOnCzmk2cvPvN3e4dHpbUOYWnClMho3b4vhL83cvCfVcf56f iTfA== 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=rGVGilXjG4pPCuMSQi6UHjMmBDlevmCkR8lJXBRqqRo=; b=T8yEyv6f6RsfDyHUg8JABAl+AjYGwAIg48ADrEoW2lZ02r7sUXLZUtZcfGCkoc3831 4aHejY+jBYX6kzD9QP0tdCKDQC89fSImHkew/Z/wuYQefJj0mvWxFWq6R/TghnoKZEnj 7+bAPdzVuSAfoj0BVpcruHnwGBn6kqscNB5j0e+6xGqJbnLv7HhWnuYY+zwXbhBH4ppP 49lxgMnLQg/QIdTJQgF4LeKOw3tWKgo9Leza2JQ9sA9BgCwrrCmpPeVXLfIfh9C6gyo+ O3AjwoatEhgLudraXc89Qu/G8a1Ke1n50lG4dL2e1pQI263Zdl9EAMGWgoXgWCC+L1is FIYw== X-Gm-Message-State: ALyK8tJCHakHPOYDvW78H/kZBcZUTti7BwFFUZWqNItNkBFDsYfO1XYhzjVAxL0Xp+MlWw== X-Received: by 10.194.243.101 with SMTP id wx5mr10166159wjc.132.1465742067303; Sun, 12 Jun 2016 07:34:27 -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 u71sm4088992wmu.13.2016.06.12.07.34.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Jun 2016 07:34:26 -0700 (PDT) From: Sudip Mukherjee To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset Date: Sun, 12 Jun 2016 15:34:21 +0100 Message-Id: <1465742061-5360-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 timer. Lets now use the helper devm_add_action_or_reset() and return and so in case of error the cleanup function will be called by the helper to delete the timer. Signed-off-by: Sudip Mukherjee --- drivers/input/keyboard/snvs_pwrkey.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c index 24a9f59..c301419 100644 --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -150,7 +150,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) input_set_capability(input, EV_KEY, pdata->keycode); /* input customer action to cancel release timer */ - error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata); + error = devm_add_action_or_reset(&pdev->dev, + imx_snvs_pwrkey_act, pdata); if (error) { dev_err(&pdev->dev, "failed to register remove action\n"); return error;