Linux CAN drivers development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: guoqi0226 <guoqi0226@163.com>
Cc: "Oliver Hartkopp" <socketcan@hartkopp.net>,
	linux-can@vger.kernel.org,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	"Vincent Mailhol" <mailhol@kernel.org>,
	"Marc Kleine-Budde" <mkl@pengutronix.de>
Subject: Re: [PATCH v2] can: mcp251xfd: Add ACPI device ID table for MCP251XFD
Date: Tue, 16 Jun 2026 09:07:42 +0000	[thread overview]
Message-ID: <20260616090742.E80BE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260616085359.89406-2-guoqi0226@163.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [Medium] Undocumented removal of `netdev_info` print in `mcp251xfd_handle_txatif`.

Pre-existing issues:
- [High] Infinite loop / interrupt storm in `mcp251xfd_irq` due to unhandled `TXATIF` interrupt flag.
- [High] NULL pointer dereference when retrieving match data if the device is bound manually via sysfs `driver_override`.
--

commit ac99a03d44f8633aff78ad69c67bdd4c8da1aa29
Author: guoqi0226 <guoqi0226@163.com>

can: mcp251xfd: Add ACPI device ID table for MCP251XFD

This patch adds an ACPI match table for the MCP251XFD CAN controller,
enabling driver binding on ACPI-enumerated SPI platforms.

> diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> index 92a86083c8962..0319673707289 100644
> --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c

[ ... ]

> @@ -982,7 +983,6 @@ static int mcp251xfd_handle_rxovif(struct mcp251xfd_priv *priv)
>  
>  static int mcp251xfd_handle_txatif(struct mcp251xfd_priv *priv)
>  {
> -	netdev_info(priv->ndev, "%s\n", __func__);
>  
>  	return 0;
>  }

[Severity: Medium]
Is this removal intentional? The commit message only mentions adding an
ACPI match table, but this modifies the interrupt handler by removing
a debug print. If it is intentional, should it be mentioned in the
commit message?

[Severity: High]
This is a pre-existing issue, but does this empty function cause an
infinite interrupt loop?

Because TXATIF is not part of MCP251XFD_REG_INT_IF_CLEARABLE_MASK, the
hardware flag must be manually cleared in the FIFOSTA register. Since
mcp251xfd_handle_txatif() returns 0 without clearing the flag, won't
the do-while loop in mcp251xfd_irq() continually read TXATIF as pending
and loop infinitely?

[ ... ]

> @@ -2212,6 +2212,14 @@ static const struct spi_device_id mcp251xfd_id_table[] = {
>  };
>  MODULE_DEVICE_TABLE(spi, mcp251xfd_id_table);
>  
> +#ifdef CONFIG_ACPI
> +static const struct acpi_device_id mcp251xfd_acpi_match[] = {
> +	{ "MCHP15FD", (kernel_ulong_t)&mcp251xfd_devtype_data_mcp251xfd},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(acpi, mcp251xfd_acpi_match);
> +#endif
> +
>  static int mcp251xfd_probe(struct spi_device *spi)
>  {
>  	struct net_device *ndev;

[Severity: High]
This is a pre-existing issue, but is it safe to unconditionally
dereference the match data retrieved in this function?

Later in mcp251xfd_probe(), the driver does:

priv->devtype_data = *(struct mcp251xfd_devtype_data *)spi_get_device_match_data(spi);

If the driver is bound manually via the sysfs driver_override attribute
without matching any table entries, spi_get_device_match_data() will
return NULL, which would cause a panic when dereferenced. Should there
be a check for NULL before dereferencing it?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260616085359.89406-1-guoqi0226@163.com?part=1

  reply	other threads:[~2026-06-16  9:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260616031332.0F34C1F000E9@smtp.kernel.org 20260616-teal-wrasse-of-conversion-348af0-mkl@pengutronix.de>
2026-06-16  8:53 ` [PATCH v2 0/1] can: mcp251x: Add ACPI device ID table for MCP2515 guoqi0226
2026-06-16  8:53   ` [PATCH v2] can: mcp251xfd: Add ACPI device ID table for MCP251XFD guoqi0226
2026-06-16  9:07     ` sashiko-bot [this message]
2026-06-16  9:16       ` [PATCH v3 0/1] " guoqi0226
2026-06-16  9:16         ` [PATCH v3 1/1] " guoqi0226
2026-06-16  9:26           ` sashiko-bot
2026-06-16 10:30             ` [PATCH v4 0/2] " guoqi0226
2026-06-16 10:30               ` [PATCH v4 1/2] can: mcp251xfd: mcp251xfd: Cache and validate match data pointer in probe guoqi0226
2026-06-16 10:30               ` [PATCH v4 2/2] spi: Add NULL check for spi_get_device_id() in spi_get_device_match_data() guoqi0226
2026-06-16 10:45                 ` sashiko-bot
2026-06-16 10:35               ` [PATCH v4 0/2] can: mcp251xfd: Add ACPI device ID table for MCP251XFD Mark Brown
     [not found]                 ` <15819af8.9491.19ed00ac23e.Coremail.guoqi0226@163.com>
2026-06-16 10:51                   ` Mark Brown
2026-06-16 10:52                 ` guoqi0226
2026-06-16 11:33               ` (subset) " Mark Brown
2026-06-16  9:45   ` [PATCH v2 0/1] can: mcp251x: Add ACPI device ID table for MCP2515 Marc Kleine-Budde

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=20260616090742.E80BE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=guoqi0226@163.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=o.rempel@pengutronix.de \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=socketcan@hartkopp.net \
    /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