Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp638568pxx; Mon, 26 Oct 2020 17:43:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxDMI+iLKE43JpYsaRxVx6YkIpfoh/Jv1f97C+H2IUWeG36Ab0a+OHdR9g3pySblNfiDLU X-Received: by 2002:a50:cc0c:: with SMTP id m12mr17889954edi.292.1603759433092; Mon, 26 Oct 2020 17:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603759433; cv=none; d=google.com; s=arc-20160816; b=yjHkP+us4GZnCEdHt2l69hjWRbxRXtnNo19Y93PrLQ2SXLCtK7qX0qEz2qejwbx1lo f1s5DAI51NXqrwQYZ0vLOdDWwCaY5FgsBE4JLF86q42HUzDQRhoNXL5sMcQEQuAh8r5w dtuCgR6ThBzr78XD7/WJAxdU/rMSJo7e0Jtdnc5Du0mnpOxr5bRQH/39FroQ4aYr7J19 ij3WePXZY5osGbYhH21yXo35uC3M9O0HNRnF5haGzv/I2lzdHQaSmYAn91DiT1BR74Xe f731wVr6gL+eeI7Ri5dzuv5/lUlvtCQbXJGXUHsuG2Oo04kGbzbhS6GEFZCPQ/cKEtIL x/Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=b4N11YwTzNHOo0efHJkwv4kXFhmQ/egolvVRzOvrSbM=; b=OEbvplIakkgjAQGeRDglcUzmv/eFF8H2L80XmE4G9UkiBTeI4DE5+lv/8a0Kg+VKYP XLOgJDcRDq/f4SfA6ugTe1w6fRdkor3DY42CrA5ALBQAAVifgnAl8NWdskSIXf8iAjoG kWjG0bwoXP/BFtBOndvH7O5gq1Imke5rfwQZnZJf0+BbGsqsXVlRwBje+MPYRSusP/Yd 88rJd7PxfXM6464XuUPXw46I/zjsZp0lw6Iut5jZYVwjBJk4/KQznpIQYZmh6nV91gKK 3eMFcC4ZeijWqNw9gMq7AuG5FOm0IT8ZoSxkprpjNy9wav7tTA5IAGBDgcCP8NgPjQO/ nN7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MUJxls4a; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l12si8180333edi.370.2020.10.26.17.43.31; Mon, 26 Oct 2020 17:43:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=MUJxls4a; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443774AbgJ0Abu (ORCPT + 99 others); Mon, 26 Oct 2020 20:31:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:53060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409520AbgJZXvr (ORCPT ); Mon, 26 Oct 2020 19:51:47 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C049521D41; Mon, 26 Oct 2020 23:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756306; bh=JqPoYV47KK0pwBWa3+G12HTHz4SPvU5B/9nnOWIg1Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUJxls4aAfKgEYcySY0LVFWTX1CSVFTAM8eWQuHI2vnOUMjEq+ZlIJdQNiEdZ7uYy S3Zq0dfa1z9MNCuK4fThTHCb4h2W/acpU711gfjd10BIvhlWVumqvKQcm5ehjPCgC6 1Fdwlzv9IGQKKNy1T+RPuqIUtQGIofV5247L9oxQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anson Huang , =?UTF-8?q?Guido=20G=C3=BCnther?= , Shawn Guo , Sasha Levin , linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.9 131/147] soc: imx: gpcv2: Use dev_err_probe() to simplify error handling Date: Mon, 26 Oct 2020 19:48:49 -0400 Message-Id: <20201026234905.1022767-131-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang [ Upstream commit b663b798d04fb73f1ad4d54c46582d2fde7a76d6 ] 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 Reviewed-by: Guido Günther Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- 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 6cf8a7a412bde..db7e7fc321b16 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.25.1