Commit e0e0ee02 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Wim Van Sebroeck

watchdog: s3c2410_wdt: Simplify using dev_err_probe()

Make use of dev_err_probe() also for error paths that don't have to
handle -EPROBE_DEFER. While the code handing -EPROBE_DEFER isn't used
for these error paths, it still simpler as it cares for pretty printing
the error code and usually needs one code line less as it combines
message emitting and error returning. This also unifies the format of
the error messages.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230307065603.2253054-3-u.kleine-koenig@pengutronix.de
[groeck: Split long line to avoid checkpatch warning]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 16d477a1
...@@ -601,10 +601,8 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt) ...@@ -601,10 +601,8 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
err = of_property_read_u32(dev->of_node, err = of_property_read_u32(dev->of_node,
"samsung,cluster-index", &index); "samsung,cluster-index", &index);
if (err) { if (err)
dev_err(dev, "failed to get cluster index\n"); return dev_err_probe(dev, -EINVAL, "failed to get cluster index\n");
return -EINVAL;
}
switch (index) { switch (index) {
case 0: case 0:
...@@ -615,8 +613,7 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt) ...@@ -615,8 +613,7 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
&drv_data_exynosautov9_cl1; &drv_data_exynosautov9_cl1;
break; break;
default: default:
dev_err(dev, "wrong cluster index: %u\n", index); return dev_err_probe(dev, -EINVAL, "wrong cluster index: %u\n", index);
return -EINVAL;
} }
} }
#endif #endif
...@@ -653,10 +650,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ...@@ -653,10 +650,9 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) { if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) {
wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
"samsung,syscon-phandle"); "samsung,syscon-phandle");
if (IS_ERR(wdt->pmureg)) { if (IS_ERR(wdt->pmureg))
dev_err(dev, "syscon regmap lookup failed.\n"); return dev_err_probe(dev, PTR_ERR(wdt->pmureg),
return PTR_ERR(wdt->pmureg); "syscon regmap lookup failed.\n");
}
} }
wdt_irq = platform_get_irq(pdev, 0); wdt_irq = platform_get_irq(pdev, 0);
...@@ -694,21 +690,17 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ...@@ -694,21 +690,17 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
if (ret) { if (ret) {
ret = s3c2410wdt_set_heartbeat(&wdt->wdt_device, ret = s3c2410wdt_set_heartbeat(&wdt->wdt_device,
S3C2410_WATCHDOG_DEFAULT_TIME); S3C2410_WATCHDOG_DEFAULT_TIME);
if (ret == 0) { if (ret == 0)
dev_warn(dev, "tmr_margin value out of range, default %d used\n", dev_warn(dev, "tmr_margin value out of range, default %d used\n",
S3C2410_WATCHDOG_DEFAULT_TIME); S3C2410_WATCHDOG_DEFAULT_TIME);
} else { else
dev_err(dev, "failed to use default timeout\n"); return dev_err_probe(dev, ret, "failed to use default timeout\n");
return ret;
}
} }
ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0, ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0,
pdev->name, pdev); pdev->name, pdev);
if (ret != 0) { if (ret != 0)
dev_err(dev, "failed to install irq (%d)\n", ret); return dev_err_probe(dev, ret, "failed to install irq (%d)\n", ret);
return ret;
}
watchdog_set_nowayout(&wdt->wdt_device, nowayout); watchdog_set_nowayout(&wdt->wdt_device, nowayout);
watchdog_set_restart_priority(&wdt->wdt_device, 128); watchdog_set_restart_priority(&wdt->wdt_device, 128);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment