From: Uwe Kleine-König (The Capable Hub) 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) Link: https://patch.msgid.link/20260618140147.142489-2-u.kleine-koenig@baylibre.com Cc: Vincent Mailhol Cc: Rob Herring Cc: Marc Kleine-Budde Cc: linux-can@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jean-Michel Hautbois Signed-off-by: Marc Kleine-Budde --- 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