Re: [PATCH 8/9] watchdog: sama5d4: Remove redundant dev_err()

[email protected] Wed, 22 Jul 2026 08:48:55 +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:

Pre-existing issues:
- [High] Probe order bug: shared interrupt is requested before drvdata is initialized, leading to a potential NULL pointer dereference in the interrupt handler.
--

--- Patch [8]: [PATCH 8/9] watchdog: sama5d4: Remove redundant dev_err() ---
commit 47cdf2034aad624309814a76e94fadcc6063281c
Author: Pan Chuang <[email protected]>

watchdog: sama5d4: Remove redundant dev_err()

Since devm_request_irq() automatically logs detailed error messages on
failure, this commit removes the now-redundant driver-specific dev_err()
call from the probe path.

> diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c
> index 704b786cc2ec6..ecdd9aeab79cc 100644
> --- a/drivers/watchdog/sama5d4_wdt.c
> +++ b/drivers/watchdog/sama5d4_wdt.c
> @@ -291,10 +291,8 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
>  		ret = devm_request_irq(dev, irq, sama5d4_wdt_irq_handler,
>  				       IRQF_SHARED | IRQF_IRQPOLL |
>  				       IRQF_NO_SUSPEND, pdev->name, pdev);

[Severity: High]
This is a pre-existing issue, but since IRQF_SHARED is used here, could the
interrupt fire immediately if another device on the same line triggers it, or
if there is a pending hardware interrupt?

If that happens, sama5d4_wdt_irq_handler() will be called with pdev as dev_id:

drivers/watchdog/sama5d4_wdt.c:sama5d4_wdt_irq_handler() {
	struct sama5d4_wdt *wdt = platform_get_drvdata(dev_id);
	...
	if (wdt->sam9x60_support)
	...
}

Because platform_set_drvdata() is called much later in sama5d4_wdt_probe(),
platform_get_drvdata(dev_id) will return a null pointer. Does this result in
a null pointer dereference during probe?

> -		if (ret) {
> -			dev_err(dev, "cannot register interrupt handler\n");
> +		if (ret)
>  			return ret;
> -		}
>  	}

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=8