Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp454294pxb; Wed, 22 Sep 2021 06:02:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCfq2kz/91/tsxBND30Ja6aNLa+883U0E2DUdAuP1MGZIFDORfRz94wT2zbAQBk0444gRZ X-Received: by 2002:a05:6638:1696:: with SMTP id f22mr4751430jat.15.1632315767891; Wed, 22 Sep 2021 06:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632315767; cv=none; d=google.com; s=arc-20160816; b=g2F/zeEp85KrLqxkm9MGuQTmBOKTgbMd6+CKOGBj/Xv6UeqGpwKc7D+LzcLmvk4Tvy yS0qmeSVm+oYmhgFXv6Gws5fEADnIG92LFKCoLMXPEpLg8JQ+7Mox5DWcPbGwPl3/YJq pHBHdom1GMkC92yU3O749cVyiMs0ufERFZBr8UMnSEQCjgrrm45v3NoxCBaMghBoTyPl ZY5ear9Urk7pmJpmc0emZmdPis+Eanfy86HI7EfkhA/rdIF3K7SvwB6JkOTgAyVq3/TU 4ilwAjgaG0c7m4C79sJyAZbgqXFT1jLoOPG46QWxIfdxzhgZ05bQYJOKw4FQTkZPmCcn Hb0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=LT6hz/akk/pZY3Ks3RwsoFS7dr83pfvx5drb1TJLiGU=; b=hUD0RM07zqcm5MXSLd4G2OtlIM+CyuEldMi5NwZ/klb5D6W6XRIcxoBrWLCXYrSmtc 5B+8QUyIZsB0ZEGUWBn4Fy6h1BfUDYWWNVt6Lk7RAj9kfAvARRGk3SAAEy/Fy9Co2jn/ UOxTucSC0U05R10G5O7oy4a5+wZCdfDBgVOWfRmIJVo4WvZEUz5m4Nc4ivj4jklo07kd WpFMQM25AT5sY1F8S5rSuML1w6WvTQchzmZfkf1u0JJHwwVzdW2ChjaOLQjoykZOxaQz Ms3l7s7YmW0QYJGEaAIRrAVR+7s0Kn2z21zqGCymYyZugG9zy7EYKlS2btEMGVbgqSzZ 6Eww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si2514553ilq.167.2021.09.22.06.02.19; Wed, 22 Sep 2021 06:02:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbhIVNCG (ORCPT + 99 others); Wed, 22 Sep 2021 09:02:06 -0400 Received: from mx24.baidu.com ([111.206.215.185]:55714 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231585AbhIVNCC (ORCPT ); Wed, 22 Sep 2021 09:02:02 -0400 Received: from BJHW-Mail-Ex05.internal.baidu.com (unknown [10.127.64.15]) by Forcepoint Email with ESMTPS id 720D3FAF1D7B11E54F0B; Wed, 22 Sep 2021 21:00:31 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex05.internal.baidu.com (10.127.64.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 22 Sep 2021 21:00:31 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 22 Sep 2021 21:00:30 +0800 From: Cai Huoqing To: CC: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner , , , , Subject: [PATCH] phy: rockchip-inno-usb2: Make use of the helper function devm_add_action_or_reset() Date: Wed, 22 Sep 2021 21:00:23 +0800 Message-ID: <20210922130024.745-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BJHW-Mail-Ex09.internal.baidu.com (10.127.64.32) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) X-Baidu-BdMsfe-DateCheck: 1_BJHW-Mail-Ex05_2021-09-22 21:00:31:487 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The helper function devm_add_action_or_reset() will internally call devm_add_action(), and gif devm_add_action() fails then it will execute the action mentioned and return the error code. So use devm_add_action_or_reset() instead of devm_add_action() to simplify the error handling, reduce the code. Signed-off-by: Cai Huoqing --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 4f569d9307b9..1938365abbb3 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -321,7 +321,7 @@ rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy) struct device_node *node = rphy->dev->of_node; struct clk_init_data init; const char *clk_name; - int ret; + int ret = 0; init.flags = 0; init.name = "clk_usbphy_480m"; @@ -352,15 +352,8 @@ rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy) if (ret < 0) goto err_clk_provider; - ret = devm_add_action(rphy->dev, rockchip_usb2phy_clk480m_unregister, - rphy); - if (ret < 0) - goto err_unreg_action; - - return 0; + return devm_add_action_or_reset(rphy->dev, rockchip_usb2phy_clk480m_unregister, rphy); -err_unreg_action: - of_clk_del_provider(node); err_clk_provider: clk_unregister(rphy->clk480m); err_ret: -- 2.25.1