Re: [PATCH 8/9] watchdog: w83627hf_wdt: Report all initialization failures in probe

Guenter Roeck <[email protected]> Sat, 25 Jul 2026 07:28:29 -0700
Newsgroups org.kernel.vger.linux-watchdog,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 7/25/26 03:29, Paul Louvel wrote:
> The driver currently logs an error only if the chip initialization
> fails. Extend the error reporting to all failure paths in probe to
> improve diagnostics.
> 
> Signed-off-by: Paul Louvel <[email protected]>
> ---
>   drivers/watchdog/w83627hf_wdt.c | 25 +++++++++++++++----------
>   1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
> index 90d41f21aa5e..cf1a3fb3a6fd 100644
> --- a/drivers/watchdog/w83627hf_wdt.c
> +++ b/drivers/watchdog/w83627hf_wdt.c
> @@ -479,12 +479,16 @@ static int wdt_probe(struct platform_device *pdev)
>   	pr_info("WDT driver for %s Super I/O chip initialising\n", id->name);
>   
>   	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> -	if (!res)
> -		return -ENXIO;
> +	if (!res) {
> +		ret = -ENXIO;
> +		goto fail;

No way. Use "return dev_err_probe(...);" instead.> +	}
>   
>   	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> -	if (!data)
> -		return -ENOMEM;
> +	if (!data) {
> +		ret = -ENOMEM;
> +		goto fail;
> +	}

Not for this one, as Sashiko points out.

Guenter