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

[email protected] Sat, 25 Jul 2026 10:36:35 +0000
Newsgroups org.kernel.vger.linux-watchdog
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(=
s) to consider:
- [Low] Redundant and discouraged custom error logging on memory allocation=
 failure.
--

--- Patch [8]: [PATCH 8/9] watchdog: w83627hf_wdt: Report all initializatio=
n failures in probe ---
commit 2d2f57b98d7747ee2d5b243ffbdaf86d9f565235
Author: Paul Louvel <[email protected]>

watchdog: w83627hf_wdt: Report all initialization failures in probe

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.

> diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_=
wdt.c
> index 90d41f21aa5e2..cf1a3fb3a6fd3 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)
[ ... ]
>  	data =3D devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> -	if (!data)
> -		return -ENOMEM;
> +	if (!data) {
> +		ret =3D -ENOMEM;
> +		goto fail;
> +	}

[Severity: Low]
Does this introduce redundant logging for memory allocation failures?

When devm_kzalloc() fails, the kernel's memory management subsystem already
dumps a highly visible warning and stack trace. Routing this failure path
to the fail label adds a custom pr_err() for the OOM condition.

Could we return -ENOMEM directly here instead of jumping to the fail label
to avoid redundant log spam?

[ ... ]
> +fail:
> +	pr_err("failed to initialize watchdog (err=3D%d)\n", ret);
>  	return ret;
>  }

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260725-w83627hf_w=
[email protected]?part=3D8