Linux Watchdog driver development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH 8/9] watchdog: sama5d4: Remove redundant dev_err()
Date: Wed, 22 Jul 2026 08:48:55 +0000	[thread overview]
Message-ID: <20260722084856.CCE711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722084218.79073-9-panchuang@vivo.com>

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 <panchuang@vivo.com>

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/20260722084218.79073-1-panchuang@vivo.com?part=8

  reply	other threads:[~2026-07-22  8:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  8:42 [PATCH 0/9] watchdog: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-22  8:42 ` [PATCH 1/9] watchdog: bd96801_wdt: Remove redundant dev_err_probe() Pan Chuang
2026-07-22  8:58   ` sashiko-bot
2026-07-22  8:42 ` [PATCH 2/9] watchdog: cadence_wdt: Remove redundant dev_err() Pan Chuang
2026-07-22  8:52   ` sashiko-bot
2026-07-22  8:42 ` [PATCH 3/9] watchdog: intel-mid_wdt: " Pan Chuang
2026-07-22  8:49   ` sashiko-bot
2026-07-22  8:42 ` [PATCH 4/9] watchdog: keembay: Remove redundant dev_err_probe() Pan Chuang
2026-07-22  8:51   ` sashiko-bot
2026-07-22  8:42 ` [PATCH 5/9] watchdog: marvell_gti: " Pan Chuang
2026-07-22  8:51   ` sashiko-bot
2026-07-22  8:42 ` [PATCH 6/9] watchdog: orion: Remove redundant dev_err() Pan Chuang
2026-07-22  8:50   ` sashiko-bot
2026-07-22  8:42 ` [PATCH 7/9] watchdog: realtek_otto: Remove redundant dev_err_probe() Pan Chuang
2026-07-22  8:55   ` sashiko-bot
2026-07-22  8:42 ` [PATCH 8/9] watchdog: sama5d4: Remove redundant dev_err() Pan Chuang
2026-07-22  8:48   ` sashiko-bot [this message]
2026-07-22  9:20   ` Alexandre Belloni
2026-07-22  8:42 ` [PATCH 9/9] watchdog: sprd: " Pan Chuang
2026-07-22  8:51   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260722084856.CCE711F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=panchuang@vivo.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox