Skip to contentSkip to conversation

can: mscan: mpc5xxx_can: Make use of the helper function dev_err_probe()

PATCH In review Cai Huoqing 2 participants 2 messages Sep 15, 2021 – Oct 19, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: mscan: mpc5xxx_can: 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 simplify the code.

---
 drivers/net/can/mscan/mpc5xxx_can.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/can/mscan/mpc5xxx_can.c +2 -4
index 35892c1efef0..de4ddf79ba9b 100644
@@ -293,10 +293,8 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
 		return -EINVAL;
 
 	base = of_iomap(np, 0);
-	if (!base) {
-		dev_err(&ofdev->dev, "couldn't ioremap\n");
-		return err;
-	}
+	if (!base)
+		return dev_err_probe(&ofdev->dev, err, "couldn't ioremap\n");
 
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Cai Huoqing

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 simplify the code.

Applied to linux-can-next/testing.

Thanks,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |