]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
soc: aspeed: lpc-snoop: Use dev_err_probe() where possible
authorAndrew Jeffery <andrew@codeconstruct.com.au>
Mon, 16 Jun 2025 13:13:45 +0000 (22:43 +0930)
committerAndrew Jeffery <andrew@codeconstruct.com.au>
Tue, 8 Jul 2025 02:05:07 +0000 (11:35 +0930)
Exploit that it returns the provided error to eliminate some lines, and
return the actual error involved rather than -ENODEV.

Link: https://patch.msgid.link/20250616-aspeed-lpc-snoop-fixes-v2-8-3cdd59c934d3@codeconstruct.com.au
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
drivers/soc/aspeed/aspeed-lpc-snoop.c

index d07c3b2d294069f49ba71b46ec8a790f9af4ff23..136e30c707ede48433a529dd82a841c2005be0d4 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/bitops.h>
 #include <linux/clk.h>
+#include <linux/dev_printk.h>
 #include <linux/interrupt.h>
 #include <linux/fs.h>
 #include <linux/kfifo.h>
@@ -315,10 +316,8 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
        }
 
        lpc_snoop->regmap = syscon_node_to_regmap(np);
-       if (IS_ERR(lpc_snoop->regmap)) {
-               dev_err(dev, "Couldn't get regmap\n");
-               return -ENODEV;
-       }
+       if (IS_ERR(lpc_snoop->regmap))
+               return dev_err_probe(dev, PTR_ERR(lpc_snoop->regmap), "Couldn't get regmap\n");
 
        dev_set_drvdata(&pdev->dev, lpc_snoop);
 
@@ -329,12 +328,8 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
        }
 
        lpc_snoop->clk = devm_clk_get_enabled(dev, NULL);
-       if (IS_ERR(lpc_snoop->clk)) {
-               rc = PTR_ERR(lpc_snoop->clk);
-               if (rc != -EPROBE_DEFER)
-                       dev_err(dev, "couldn't get clock\n");
-               return rc;
-       }
+       if (IS_ERR(lpc_snoop->clk))
+               return dev_err_probe(dev, PTR_ERR(lpc_snoop->clk), "couldn't get clock");
 
        rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev);
        if (rc)