From patchwork Tue Aug 23 14:58:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9295781 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 6AD0B60574 for ; Tue, 23 Aug 2016 15:01:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A7F62891A for ; Tue, 23 Aug 2016 15:01:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E2FA28C42; Tue, 23 Aug 2016 15:01:21 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 309EC2891A for ; Tue, 23 Aug 2016 15:01:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bcDAq-0005kS-Ka; Tue, 23 Aug 2016 14:59:32 +0000 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bcDAk-0005dJ-1d; Tue, 23 Aug 2016 14:59:27 +0000 Received: by mail-pa0-x242.google.com with SMTP id hh10so10097538pac.1; Tue, 23 Aug 2016 07:59:05 -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=YZzsuF+GsxNd4tTWSJZBeza9S+wh3kZWisQ26n+RhdY=; b=dxTcmwqMdOY7Ni+ffyFKk0wXYoMPu+Z18I6jolcSh0ZotqnBAQ/gHZmGuAhtHEClcY Gnp74jlNGVbESYMBU1xlNP2r2nJP9kYePejBi5yXeJivPfiDjdylzJF+wFyIH7LHahkj LggOxmBvedfw/VGCwyoMJ2dGmL4e0rX3txwWljfz/zp1yyOdbnLjxd3IoRKhTh/9GpVR CY8Pr3sXSCzsTrPLURXBguFPYBjGZmhT0wAxbDFmRjbQ12THrc4bITdog9ZQO6zfKOZi zE4D3v8N1XxmCDFKZw/1qxFV618JhJ4Pf9OwtUfNsfhK8y2oDEUidufAPyXAQsxo7tD8 ZIGg== 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=YZzsuF+GsxNd4tTWSJZBeza9S+wh3kZWisQ26n+RhdY=; b=mlUZe9kL0lPpwgnak6YTRLjiecnZydqIdoqLjh5lU+RWrOD7NJDmkFkWmrNuJQk/3A Nxaie4NmyTWrvf1wrRIxhbSyaHljxNdIVt04f6kuCKkD1K2ubpCrNBQXhAseAWmE9uO/ LI3gzARcqC8mvAyybY9ng4ivwcrgqjQb+fAUFm15Yf0IuKo9kJXhN+isEmIn/oNjqMAz +Zj2S8e8DpfAA9hZ8pvVj+y9jcBPP99Luu4GJAyvTYATmghgNqUTGzaqHpxDgy/2A449 NVYEFkObbA5K2T2MKTMMORHBUq1FHSJKeK0DVWhXICz5fIa2ZtP96XjsXJYe1FRczwPn sdxg== X-Gm-Message-State: AEkoouvfmZcqb8xvs7jbliU2JnGd1Nz9/ryVzthPLGltiYkhOqNbaCkPgN8OSJB3WZqH+A== X-Received: by 10.66.53.234 with SMTP id e10mr54300136pap.28.1471964344655; Tue, 23 Aug 2016 07:59:04 -0700 (PDT) Received: from localhost.localdomain ([103.24.124.194]) by smtp.gmail.com with ESMTPSA id p9sm6520218pfj.3.2016.08.23.07.59.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Aug 2016 07:59:04 -0700 (PDT) From: Sudip Mukherjee To: Herbert Xu , "David S. Miller" , Heiko Stuebner Subject: [PATCH] crypto: rockchip - use devm_add_action_or_reset() Date: Tue, 23 Aug 2016 20:28:54 +0530 Message-Id: <1471964334-27060-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160823_075926_265286_98769C4B X-CRM114-Status: GOOD ( 10.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, Sudip Mukherjee , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 Reviewed-by: Heiko Stuebner --- drivers/crypto/rockchip/rk3288_crypto.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c index af50825..d0f80c6 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.c +++ b/drivers/crypto/rockchip/rk3288_crypto.c @@ -304,11 +304,9 @@ static int rk_crypto_probe(struct platform_device *pdev) usleep_range(10, 20); reset_control_deassert(crypto_info->rst); - err = devm_add_action(dev, rk_crypto_action, crypto_info); - if (err) { - reset_control_assert(crypto_info->rst); + err = devm_add_action_or_reset(dev, rk_crypto_action, crypto_info); + if (err) goto err_crypto; - } spin_lock_init(&crypto_info->lock);