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: 9295779 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 9C14860574 for ; Tue, 23 Aug 2016 15:00:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D6802891A for ; Tue, 23 Aug 2016 15:00:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81E0D28C42; Tue, 23 Aug 2016 15:00:59 +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 0DA912891A for ; Tue, 23 Aug 2016 15:00:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752306AbcHWPAZ (ORCPT ); Tue, 23 Aug 2016 11:00:25 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34830 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbcHWPAX (ORCPT ); Tue, 23 Aug 2016 11:00:23 -0400 Received: by mail-pa0-f68.google.com with SMTP id cf3so10042974pad.2; 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=QNjskqYfHIQtEaMMKvr05mcJ9vD1WVwEUvGS+gLDUPHmF5Sy3CmgvY1Sx1AxQseY94 TbzHk4lm7s6ThCih2AcKvy0JcosMvKMxt0+4jZeZcgvs7a3OuuPDpojJb1T+n1zuaxye QI47e2wyybVra7AFjW95eNNzuxgyiZzDRHWtxjpPvDdTaWJU0xObid0us/PJQVfKPQNP hYlm5GfoG4Esk1pS04oVCTDJsoDm1S8PXkn0bBmeLnXbWvtNx8jFpjD6qKRogPU3Ewl5 9JQoaySPuW/hVggEedShSp/2+2lX+vorGG0KZUc31YeyNJPyGNubKKe1Oqx4RClx2wzT QYDw== X-Gm-Message-State: AEkoouuAwcaT5Y2A/QvQ+0esL8NHpdzHh1B0y6kbxF/3ufETMJsIO2OC+kCrhslwg6mOag== 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 Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Sudip Mukherjee 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 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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 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);