From patchwork Sun Jul 3 20:48:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9211439 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 5FA306075F for ; Sun, 3 Jul 2016 20:49:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 512E728608 for ; Sun, 3 Jul 2016 20:49:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44A89286CA; Sun, 3 Jul 2016 20:49: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 068FB28608 for ; Sun, 3 Jul 2016 20:49:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932144AbcGCUsx (ORCPT ); Sun, 3 Jul 2016 16:48:53 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33995 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932124AbcGCUsx (ORCPT ); Sun, 3 Jul 2016 16:48:53 -0400 Received: by mail-wm0-f66.google.com with SMTP id 187so17449391wmz.1; Sun, 03 Jul 2016 13:48:52 -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=ntT4NN+DiAF/PG3UuTszLrdZGrdc5gCMtQFWD2DvtPc=; b=RdtAruCOVWH5eOdR+Sb05gHhPM/ewMUHbbDc726lCSbIyqJtCnq2yu9ZIjXCFbqg+E LXMpu9eTjv+OmvmzJdE2Pw/op2wpWV8s6Kw2O1sopdIF+jgdhounMJMbum0bWobO5jgk cJLE/gKeIV48AHrHoZUXfZjgZyqxalRqNRqfIeZihLucC/xzx8eODt/6+X6DuvP91/f4 CXbv76t3cPWD7k2jHirWQgjywqoGow0s3+94xiT4B3dN8BEOhYOqv8Yjz2OIS1mOBcCL M+KD7RI6j6a0UHa8wX+LTVBOi5Z72K/tAgIvZKtfJP/A2ZFESK36Gxm6nga2tlY0Fdre yPCQ== 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=ntT4NN+DiAF/PG3UuTszLrdZGrdc5gCMtQFWD2DvtPc=; b=C4sOYZJUjhblswbwLWDstmaRT3bpQPNbRl7xg9Ro2GIRzIx6m010NpludqxiwdHMpy Ywru4jBFJek4v2yh1dvCP+Q++BqnXOHaJiGGRwEJuFZexktEkctSk/egjwfDVa1XSVjG a5IE4Tf5Jbv6Kqim9ofquGUDBnrZP8nBY4hHJc1oWkRK7q9mnzUYsETQZgV0Yr5BDnPz XMXLcNRQolPC2PPNRrW3RP1JOZsG82d5gcyVRdzc/4Y0AssfVO6QbUyNA6Vi946Az3uY 9Qan12DZo+YuqjpngdeLBrNhal41+/3l3ON8bATYd9QJOP9Fjzheb3HWcW7g5Y8wOwkx yrWA== X-Gm-Message-State: ALyK8tLv81fPiy7RilbgER2mdPQfAGO+ThOSEyJQPSL4ogHWEkOdpy5F5CKm69PP0s/vJQ== X-Received: by 10.28.145.17 with SMTP id t17mr7989236wmd.14.1467578931645; Sun, 03 Jul 2016 13:48:51 -0700 (PDT) Received: from sudip-laptop.lan (219.95.112.87.dyn.plus.net. [87.112.95.219]) by smtp.gmail.com with ESMTPSA id bh7sm4122222wjb.22.2016.07.03.13.48.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Jul 2016 13:48:51 -0700 (PDT) From: Sudip Mukherjee To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] Input: zforce_ts - use devm_add_action_or_reset() Date: Sun, 3 Jul 2016 21:48:46 +0100 Message-Id: <1467578926-32297-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 explicitly calling the cleanup to free the resources allocated. Lets use the helper devm_add_action_or_reset() and return directly in case of error, as we know that the cleanup function has been already called by the helper if there was any error. Signed-off-by: Sudip Mukherjee --- drivers/input/touchscreen/zforce_ts.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 7b3845a..6053e31 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -820,15 +820,12 @@ static int zforce_probe(struct i2c_client *client, udelay(100); } - ret = devm_add_action(&client->dev, zforce_reset, ts); + ret = devm_add_action_or_reset(&client->dev, zforce_reset, ts); if (ret) { dev_err(&client->dev, "failed to register reset action, %d\n", ret); /* hereafter the regulator will be disabled by the action */ - if (!IS_ERR(ts->reg_vdd)) - regulator_disable(ts->reg_vdd); - return ret; }