Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp101460pxa; Mon, 10 Aug 2020 20:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxD4+dL/ZUj/AMxGx7UK/pyD5grZWLk7ekXNn13aU4uXeFH7Te5RZKxo3Uhs/0pqLdvzbV X-Received: by 2002:a17:906:da19:: with SMTP id fi25mr23804901ejb.405.1597115563899; Mon, 10 Aug 2020 20:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597115563; cv=none; d=google.com; s=arc-20160816; b=yVM4bCmZCqq4aXoMI4fDDI/S42Ap0EXcI6RvykaFFQFKCE80Y3lEEakWP8XF1TPSSU xYItxjmSm0cc6F4w/6IPygPiYcno37HQRNurogaQeP2QZPhCT5VUA5QnV+QSOG2p2Z/4 ivhtY+6WBSO+wuqRcdCp6bbPpCQtcVD0HN6GjxaRTOvZ7ar/FW5t4VTjSTF9Fo1PQCc6 vK6Dd7JR1xPF4DDjrXAhlxes3sad1ToqxsQOZDH5syqpB9YkaOd/gEAWLzI0hw0iXlqm uTVqnTQ23b+3rNSPy42DEyjdUgO18T2MYmjKkOTU41UHaNxrEchsnTULmjJ9GXS7Wj4Z IM9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=XpKIcs+h/ldUCfkZLVI3BqJhPENi0KmfvOI91LiWZ7g=; b=zteJmFwlbvQ0QAmFBRlQ83wkqMcF2REetxEwTXcGeYEH7v6qQmj2l671ZW+f/QfJ1p JrGgbjWKtdQElTgviDTgBxZylAlIeVawXoflal6Wlt/u+bIn6+nTqfxARP/VLKHq3rk+ BFpNNMzjIa80NPjCCYd72StH0uqSzYedqYlBK35NuZOyTmRg51mH6PnwyHtEp0XIuUZR Wf5rpp5NumTJ7HgOVZzWUErcm+KmJIRiU9cFILQabeQdpsJ2nij5TouC/x77SjiCMKpP G5ONYqKC1zb9lbrrrQ9dYQ2JHk/SclXcgQOKyJKs9v4Fvlw7y0x9PKNymsP0x6WM4CQY 57tA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp26si11949420ejb.118.2020.08.10.20.12.20; Mon, 10 Aug 2020 20:12:43 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727820AbgHKDJj (ORCPT + 99 others); Mon, 10 Aug 2020 23:09:39 -0400 Received: from inva020.nxp.com ([92.121.34.13]:51256 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726981AbgHKDJj (ORCPT ); Mon, 10 Aug 2020 23:09:39 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 253471A1D79; Tue, 11 Aug 2020 05:09:38 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6318F1A0801; Tue, 11 Aug 2020 05:09:34 +0200 (CEST) Received: from 10.192.242.69 (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5584F402EB; Tue, 11 Aug 2020 05:09:29 +0200 (CEST) From: Anson Huang To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, daniel.baluta@nxp.com, agx@sigxcpu.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH] soc: imx: gpcv2: Use dev_err_probe() to simplify error handling Date: Tue, 11 Aug 2020 11:04:42 +0800 Message-Id: <1597115082-20328-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dev_err_probe() can reduce code size, uniform error handling and record the defer probe reason etc., use it to simplify the code. Signed-off-by: Anson Huang --- drivers/soc/imx/gpcv2.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index 6cf8a7a..db7e7fc 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -487,22 +487,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) domain->regulator = devm_regulator_get_optional(domain->dev, "power"); if (IS_ERR(domain->regulator)) { - if (PTR_ERR(domain->regulator) != -ENODEV) { - if (PTR_ERR(domain->regulator) != -EPROBE_DEFER) - dev_err(domain->dev, "Failed to get domain's regulator\n"); - return PTR_ERR(domain->regulator); - } + if (PTR_ERR(domain->regulator) != -ENODEV) + return dev_err_probe(domain->dev, PTR_ERR(domain->regulator), + "Failed to get domain's regulator\n"); } else if (domain->voltage) { regulator_set_voltage(domain->regulator, domain->voltage, domain->voltage); } ret = imx_pgc_get_clocks(domain); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(domain->dev, "Failed to get domain's clocks\n"); - return ret; - } + if (ret) + return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n"); ret = pm_genpd_init(&domain->genpd, NULL, true); if (ret) { -- 2.7.4