Skip to content

Commit fa4ffb0

Browse files
committed
soc: aspeed: lpc-snoop: Use dev_err_probe() where possible
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>
1 parent 08ebd4c commit fa4ffb0

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

drivers/soc/aspeed/aspeed-lpc-snoop.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <linux/bitops.h>
1414
#include <linux/clk.h>
15+
#include <linux/dev_printk.h>
1516
#include <linux/interrupt.h>
1617
#include <linux/fs.h>
1718
#include <linux/kfifo.h>
@@ -315,10 +316,8 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
315316
}
316317

317318
lpc_snoop->regmap = syscon_node_to_regmap(np);
318-
if (IS_ERR(lpc_snoop->regmap)) {
319-
dev_err(dev, "Couldn't get regmap\n");
320-
return -ENODEV;
321-
}
319+
if (IS_ERR(lpc_snoop->regmap))
320+
return dev_err_probe(dev, PTR_ERR(lpc_snoop->regmap), "Couldn't get regmap\n");
322321

323322
dev_set_drvdata(&pdev->dev, lpc_snoop);
324323

@@ -329,12 +328,8 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev)
329328
}
330329

331330
lpc_snoop->clk = devm_clk_get_enabled(dev, NULL);
332-
if (IS_ERR(lpc_snoop->clk)) {
333-
rc = PTR_ERR(lpc_snoop->clk);
334-
if (rc != -EPROBE_DEFER)
335-
dev_err(dev, "couldn't get clock\n");
336-
return rc;
337-
}
331+
if (IS_ERR(lpc_snoop->clk))
332+
return dev_err_probe(dev, PTR_ERR(lpc_snoop->clk), "couldn't get clock");
338333

339334
rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev);
340335
if (rc)

0 commit comments

Comments
 (0)