From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
kernel@pengutronix.de,
"Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>,
stable@vger.kernel.org, "Vincent Mailhol" <mailhol@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
linux-kernel@vger.kernel.org,
"Jean-Michel Hautbois" <jeanmichel.hautbois@yoseli.org>
Subject: [PATCH net 12/12] can: flexcan: Fix probing for m68k/coldfire
Date: Tue, 24 Nov 2026 09:51:39 +0100 [thread overview]
Message-ID: <20261124085757.1093632-13-mkl@pengutronix.de> (raw)
In-Reply-To: <20261124085757.1093632-1-mkl@pengutronix.de>
From: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
When determining the device details was reworked in commit 5e6c3454b405
("net: can: Use device_get_match_data()") there was no replacement for
the previous handling of non-of instantiated devices via the device's
id_entry which then results in a NULL pointer exception. The only
in-tree provider of such a device is arch/m68k/coldfire/device.c.
Given the id_table only contains a single entry just hardcode the result
of `platform_get_device_id(pdev)->driver_data` and drop the unused
assignment to .driver_data from the table.
While touching the id table, drop the unusual comma after the terminator
entry.
Fixes: 5e6c3454b405 ("net: can: Use device_get_match_data()")
Cc: stable@vger.kernel.org
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20260618140147.142489-2-u.kleine-koenig@baylibre.com
Cc: Vincent Mailhol <mailhol@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan/flexcan-core.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index 86b40abe9e76..e9b822678213 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -2077,10 +2077,9 @@ MODULE_DEVICE_TABLE(of, flexcan_of_match);
static const struct platform_device_id flexcan_id_table[] = {
{
.name = "flexcan-mcf5441x",
- .driver_data = (kernel_ulong_t)&fsl_mcf5441x_devtype_data,
}, {
/* sentinel */
- },
+ }
};
MODULE_DEVICE_TABLE(platform, flexcan_id_table);
@@ -2148,6 +2147,15 @@ static int flexcan_probe(struct platform_device *pdev)
return PTR_ERR(regs);
devtype_data = device_get_match_data(&pdev->dev);
+ if (!devtype_data)
+ /*
+ * If the device was instantiated via the traditional platform
+ * mechanisms (i.e. not by device tree), device_get_match_data()
+ * returns NULL. The only remaining such device is mcf_flexcan0
+ * (defined in arch/m68k/coldfire/device.c). Pick the right
+ * device type for that.
+ */
+ devtype_data = &fsl_mcf5441x_devtype_data;
if ((devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) &&
!((devtype_data->quirks &
--
2.53.0
parent reply other threads:[~2026-11-24 8:58 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20261124085757.1093632-1-mkl@pengutronix.de>]
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=20261124085757.1093632-13-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=jeanmichel.hautbois@yoseli.org \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/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
all inboxes | Powered by JetHome®