Thread (57 messages) flat view 57 messages, 5 authors, 2020-08-28

Re: [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe()

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2020-08-26 19:12:25
Also in: lkml, platform-driver-x86

On Wed, Aug 26, 2020 at 08:16:43PM +0200, Krzysztof Kozlowski wrote:
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.
quoted hunk ↗ jump to hunk
+++ b/drivers/input/keyboard/bcm-keypad.c
@@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev)
 	kp->clk = devm_clk_get(&pdev->dev, "peri_clk");
 	if (IS_ERR(kp->clk)) {
 		error = PTR_ERR(kp->clk);
-		if (error != -ENOENT) {
-			if (error != -EPROBE_DEFER)
-				dev_err(&pdev->dev, "Failed to get clock\n");
-			return error;
-		}
+		if (error != -ENOENT)
+			return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
+
 		dev_dbg(&pdev->dev,
 			"No clock specified. Assuming it's enabled\n");
Shouldn't be this rather switch to devm_clk_get_optional() + dev_err_probe?
 		kp->clk = NULL;
-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help