From patchwork Sun Jul 3 21:01:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9211447 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 E855E60571 for ; Sun, 3 Jul 2016 21:03:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D57A128614 for ; Sun, 3 Jul 2016 21:03:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7FB3286AA; Sun, 3 Jul 2016 21:03:16 +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 5D68928614 for ; Sun, 3 Jul 2016 21:03:16 +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 1bJoWI-0005og-Ng; Sun, 03 Jul 2016 21:01:38 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bJoWG-0005mm-7t; Sun, 03 Jul 2016 21:01:36 +0000 Received: by mail-wm0-x242.google.com with SMTP id 187so17491599wmz.1; Sun, 03 Jul 2016 14:01:15 -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=uelXb15zFTAZVU7C3ss7Z1tnNWZtSpF+ywDIa1eFRzg=; b=gZSnREnsVOIUbMRWj2Cz+B+1JB4HvCvNlrEjP6nX36A1646IZOhxNgvapQy6qDwLjQ TEzOKC7E9o48QVRVqAIHNJ7KeyIX7LgE5yX2KJgtniXB5Et0p2gEvV2yrQkXSC0f+/Bk i16NLwGglM7aRen9c8u4EONHkf36ljgP7xzsVEZiaWsa/w7wQaFJ68xsZnEJN3p5qob9 VRScKdiHv2r+OaTBEy5xLupp/+jnqWVj6U8Ot/7JbpGYWPj65bmHbsjtBclODNzIB8/D fRixJuO9PjA606z3b+0u1nEhUMRDk0nxdU41el25dcCTUnGS+ry82PDDvUDOrG2q4TiN SwFQ== 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=uelXb15zFTAZVU7C3ss7Z1tnNWZtSpF+ywDIa1eFRzg=; b=Rbs4lskNwW3vEEPevp7fxrqx5GyBRnCKIYGaf0+tyQB9yuBOkCGJeB1WPyJ+klW1Ir NifuPwK5vjG34zxhCqWTFtMY6MtLtnPlY0q7TveJxKBh3K37cjm9SKW1wq59dCuCyDzc CZ23GLJ1HLfOstO3ha0xwzzYO2qDxdt5IzIFYdaHxPk7ePClN8HiUcSL7z1M7WPtO+m2 T2rIffJO3u6c15GsRWQDPUEn79qOuiF1TVu3eA4Cdlec1LSGlq4XKpIeIhXJBhPYlb/X 0UBOZ4mtNfTQtKmFBply3jq5GNv5CKk41R4zy+GiKuRoFEz7Z1WcsLZI07AN1qr7ov6+ eubA== X-Gm-Message-State: ALyK8tL9dfivZBvmq70yctyYIpXBp7kjPPgRpgs2wWEX0N1TYlXedgH3Br3whXiTRzbBHw== X-Received: by 10.28.197.140 with SMTP id v134mr8007788wmf.2.1467579674291; Sun, 03 Jul 2016 14:01:14 -0700 (PDT) Received: from sudip-laptop.lan ([81.174.186.114]) by smtp.gmail.com with ESMTPSA id yk6sm105182wjb.34.2016.07.03.14.01.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Jul 2016 14:01:13 -0700 (PDT) From: Sudip Mukherjee To: Kishon Vijay Abraham I , Heiko Stuebner Subject: [PATCH] phy: rockhip-usb: use devm_add_action_or_reset() Date: Sun, 3 Jul 2016 22:01:06 +0100 Message-Id: <1467579666-9179-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-20160703_140136_440148_63B38C8F X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. 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, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sudip Mukherjee 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/phy/phy-rockchip-usb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c index d60b149..dd58f23 100644 --- a/drivers/phy/phy-rockchip-usb.c +++ b/drivers/phy/phy-rockchip-usb.c @@ -236,9 +236,10 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base, goto err_clk_prov; } - err = devm_add_action(base->dev, rockchip_usb_phy_action, rk_phy); + err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action, + rk_phy); if (err) - goto err_devm_action; + return err; rk_phy->phy = devm_phy_create(base->dev, child, &ops); if (IS_ERR(rk_phy->phy)) { @@ -256,9 +257,6 @@ static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base, else return rockchip_usb_phy_power(rk_phy, 1); -err_devm_action: - if (!rk_phy->uart_enabled) - of_clk_del_provider(child); err_clk_prov: if (!rk_phy->uart_enabled) clk_unregister(rk_phy->clk480m);