lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210916101407.9601-1-caihuoqing@baidu.com>
Date:   Thu, 16 Sep 2021 18:14:06 +0800
From:   Cai Huoqing <caihuoqing@...du.com>
To:     <caihuoqing@...du.com>
CC:     Linus Walleij <linus.walleij@...aro.org>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] drm/mcde: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@...du.com>
---
 drivers/gpu/drm/mcde/mcde_drv.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index e60566a5739c..e9e4653a0732 100644
--- a/drivers/gpu/drm/mcde/mcde_drv.c
+++ b/drivers/gpu/drm/mcde/mcde_drv.c
@@ -291,11 +291,9 @@ static int mcde_probe(struct platform_device *pdev)
 
 	/* First obtain and turn on the main power */
 	mcde->epod = devm_regulator_get(dev, "epod");
-	if (IS_ERR(mcde->epod)) {
-		ret = PTR_ERR(mcde->epod);
-		dev_err(dev, "can't get EPOD regulator\n");
-		return ret;
-	}
+	if (IS_ERR(mcde->epod))
+		return dev_err_probe(dev, PTR_ERR(mcde->epod),
+				     "can't get EPOD regulator\n");
 	ret = regulator_enable(mcde->epod);
 	if (ret) {
 		dev_err(dev, "can't enable EPOD regulator\n");
@@ -303,8 +301,8 @@ static int mcde_probe(struct platform_device *pdev)
 	}
 	mcde->vana = devm_regulator_get(dev, "vana");
 	if (IS_ERR(mcde->vana)) {
-		ret = PTR_ERR(mcde->vana);
-		dev_err(dev, "can't get VANA regulator\n");
+		ret = dev_err_probe(dev, PTR_ERR(mcde->vana),
+				    "can't get VANA regulator\n");
 		goto regulator_epod_off;
 	}
 	ret = regulator_enable(mcde->vana);
@@ -320,8 +318,8 @@ static int mcde_probe(struct platform_device *pdev)
 	/* Clock the silicon so we can access the registers */
 	mcde->mcde_clk = devm_clk_get(dev, "mcde");
 	if (IS_ERR(mcde->mcde_clk)) {
-		dev_err(dev, "unable to get MCDE main clock\n");
-		ret = PTR_ERR(mcde->mcde_clk);
+		ret = dev_err_probe(dev, PTR_ERR(mcde->mcde_clk),
+				    "unable to get MCDE main clock\n");
 		goto regulator_off;
 	}
 	ret = clk_prepare_enable(mcde->mcde_clk);
@@ -333,14 +331,14 @@ static int mcde_probe(struct platform_device *pdev)
 
 	mcde->lcd_clk = devm_clk_get(dev, "lcd");
 	if (IS_ERR(mcde->lcd_clk)) {
-		dev_err(dev, "unable to get LCD clock\n");
-		ret = PTR_ERR(mcde->lcd_clk);
+		ret = dev_err_probe(dev, PTR_ERR(mcde->lcd_clk),
+				    "unable to get LCD clock\n");
 		goto clk_disable;
 	}
 	mcde->hdmi_clk = devm_clk_get(dev, "hdmi");
 	if (IS_ERR(mcde->hdmi_clk)) {
-		dev_err(dev, "unable to get HDMI clock\n");
-		ret = PTR_ERR(mcde->hdmi_clk);
+		ret = dev_err_probe(dev, PTR_ERR(mcde->hdmi_clk),
+				    "unable to get HDMI clock\n");
 		goto clk_disable;
 	}
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ