[PATCH 2/5] watchdog: dw_wdt: add error handling for reset control deassertion

From: Artem Shimko

Date: Fri Mar 20 2026 - 09:57:24 EST


The reset_control_deassert() call was performed without checking its
return value. This could lead to probe continuing even when the device
reset wasn't properly deasserted, potentially causing register access
failures or undefined behavior later.

Add proper error checking for reset_control_deassert() and return the
error code if deassertion fails. Also replace &pdev->dev with the local
dev pointer for consistency with the rest of the probe function.

Signed-off-by: Artem Shimko <a.shimko.dev@xxxxxxxxx>
---
drivers/watchdog/dw_wdt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 3450402b7707..724ba435b3c8 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -588,11 +588,13 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
if (IS_ERR(dw_wdt->pclk))
return PTR_ERR(dw_wdt->pclk);

- dw_wdt->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
+ dw_wdt->rst = devm_reset_control_get_optional_shared(dev, NULL);
if (IS_ERR(dw_wdt->rst))
return PTR_ERR(dw_wdt->rst);

- reset_control_deassert(dw_wdt->rst);
+ ret = reset_control_deassert(dw_wdt->rst);
+ if (ret)
+ return ret;

/* Enable normal reset without pre-timeout by default. */
dw_wdt_update_mode(dw_wdt, DW_WDT_RMOD_RESET);
--
2.43.0