Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp198808pxa; Tue, 11 Aug 2020 00:04:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoXcA5R7JbMIkQ4a/1RpWhpWOr3AIz3EMfkTjm4/Jk4BCgojoQqagmdLaIS1TU+nsh1o8y X-Received: by 2002:a17:906:ce39:: with SMTP id sd25mr25918187ejb.80.1597129457279; Tue, 11 Aug 2020 00:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597129457; cv=none; d=google.com; s=arc-20160816; b=QSJyFHrNQwLPMo1hqXbdld0Q2kcsnhnr3ugAL5/tFHm6RxPnDe1M9DnhOtgm74oq3U g2fRmxNjoAdHHzhZXOMBVM9GEwO3bZ0+AjBO0KeVCj55CV2Wuh8RdS3MV2a/x0lnl4Nu 9VvDjD6d5p7509Qr29qQMMS+v2CGFhk4m+hlGXT1acz1o3Z47wgitAlWiAg+G05fAVRd Gb857aUKe7vXGt4s8flmf/eRk3EsthtpBU7HaiuN5cqvH6xrJt/vPW5A3LCE9+c3vg74 tb10idQXCjS+2Kt6fcWm2HuehnXUjShP6khxSimosItwZjk9KSN7lmOQfnowOwK3uBUt Go0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yIU3AhQCjIutmTNWjqPHNWbY2j1LC0fxoewWRhw+HQc=; b=UsUBG3v7y24ML2KMGdUyVaOA3u7uV/WU8asUKuyxSKDFiyoyAAOzo3NbDiYaReBNid Tu3avxRXnMLDGkRLh+qfwDh1qmJHtiTQU6y10tJQ78zA5VUb12sCILg1nu+cthzEpRQ6 /Wa0sk3i8WnneAT/Asu4oQ9Ndl/gmyd1FfdSt6ZUzIhf2uLJOj2DdEO90kCZhGkux1yK LXsZFcBrPuKScuE46PbFuXSpyjQsBK5wSVJ7Kcvp1sn4NH3c5EHnPSVQ384u/tBrxotR JGq17U/LXW+fCyPACy9waOOs5gzQWZN7CgNyeU/93nDE0HDNSmsolR4U2UYcqCAVA+wz 3cNw== 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 ng4si12232167ejb.683.2020.08.11.00.03.54; Tue, 11 Aug 2020 00:04:17 -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 S1728132AbgHKHDN (ORCPT + 99 others); Tue, 11 Aug 2020 03:03:13 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:35078 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbgHKHDN (ORCPT ); Tue, 11 Aug 2020 03:03:13 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 5ECC3FB03; Tue, 11 Aug 2020 09:03:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 76SNf614j2F1; Tue, 11 Aug 2020 09:03:08 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 42C0445637; Tue, 11 Aug 2020 09:03:08 +0200 (CEST) Date: Tue, 11 Aug 2020 09:03:08 +0200 From: Guido =?iso-8859-1?Q?G=FCnther?= To: Anson Huang Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, daniel.baluta@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH] soc: imx: gpcv2: Use dev_err_probe() to simplify error handling Message-ID: <20200811070308.GB2904@bogon.m.sigxcpu.org> References: <1597115082-20328-1-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1597115082-20328-1-git-send-email-Anson.Huang@nxp.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Aug 11, 2020 at 11:04:42AM +0800, Anson Huang wrote: > 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) { Reviewed-by: Guido G?nther -- Guido > -- > 2.7.4 >