From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76CF43AFAFE for ; Thu, 18 Jun 2026 14:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781791390; cv=none; b=ucj3M8ZLOeNLiuEITGCobonbVLXkiu7+gfhG/WT5ucFOo99ACgIELGXzgFiZMbZI9QA7p4unGpP4NjXVGW+613mvUVbUZHyAZCGGWy99zkKmI/mIr7RBPuFq7tFIf6Dxx7QLimzLaLh1PkNHD2We6aScsxp7nZBECmYp1Ua3Ybg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781791390; c=relaxed/simple; bh=263UnQqT7FgRjQmrIuWnRIN9Xzmjzy5Zozx+IEZgAgM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=kP3oHycroIICd0K0NhqiBKUcWX9jBavPB8T6T1WWq3WMTXzsxqzSwLBhfuJN+3YQB1MU2hHZuuHzWHLfnFQ5BqlAigTdNNoQVGgjUwhbZ3jkOF89qIyAQBgPHZI2+bFPJtXvB8fbJeXOOZUs8jHGvS65us6zb3taMIT9eL1qHqU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b=pt1Lllqf; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="pt1Lllqf" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-45ef41adbc1so851369f8f.0 for ; Thu, 18 Jun 2026 07:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1781791387; x=1782396187; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jos76VU9rUcfTgCENKyUN1lsrrQ63yv55cXHCv1GV14=; b=pt1Lllqfz1DR5lS4hxUiGsQrthAzYZWCVFMOsUeERbgGrWTzXfKYxy0AIkSQzkhFAo H3Np4gA1A6ZHufF1UoiqaNQcs4usnBEC6d0fdBteYemOLjunU7q+qH3lnLAcM0MnsMrM nxqYTs18z+EHLx2380LEFg3XbH4cCC6hq3tmtgQm46KEJv5hBrAKuKjfKMNmcUh/Lb4V zIgZmCggCD6xisEF59/evzGLbzTuifT1HG81MOVxGcoSNIMR7BBtimzwZ1wnsG3z3itN FcKNNRjTK9wYB1pV496DHEqZ7FexcOWOSyny5GYeUUlr8uGrz7IvvsP+AqT9xz7XRpLx OHLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781791387; x=1782396187; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jos76VU9rUcfTgCENKyUN1lsrrQ63yv55cXHCv1GV14=; b=YUizxSJuRds9bnZyiCLmn6vlWXm/wyhos/+D4eu2qBJdxWzKymfGqaMkAbDmcRpWdu ST+Tf9mFVozQa1Kc7anx+eViFNZZ9ZCaZkWhaWusZNbcjKsnKdf62GcpuFzdgu+g8EyM 0UByYjlTSyNqlGJR4GKv1geWHCONYMW7VCrIsM6LYImbpeQfJVPjKyK+MwcfKinKP6nR pQlvoOtDcg5X7RAwWEdAzRurN28vWQzvszK//kWgjauUGouGmxpHR5oZ8CS8C13n+/6B cVp9RCfBuPZirWg4IaxfX3/ls++Hk0oLf4ntSjXjRk3iETlUQlxmz97MeL/kQx5G5vRa GrFg== X-Forwarded-Encrypted: i=1; AFNElJ8/gabJ7a3+BGpyzvXuLdRG/2zYfu6qBu5ML8HUtgBW7KPe9l0kSFegzJy0vNJ/0+F7QdVWi0zifKzJiZo=@vger.kernel.org X-Gm-Message-State: AOJu0YxP+nykzcp7tC+obNqHiUJH53TuHQMG8IHXtSlZfnvcqFcoGClA j5KUNwQC05isXRKF6w744oWqEOq0L1CmjICGYJY5z0YZxcEVCxJSzTuisHtL/i59OY0cGnGaYmS qAcR2 X-Gm-Gg: AfdE7ckK9tLBjpZQ3Yuo4kA4PBbfQ95mS5v3TOC7Tn0lGUwMsQAS+E7eBaxy2joGly8 i4FkVHUG/hGPpnzH4l9uSfAvTmv++au6KzQ2e3jSExaeNmGWar4ITw88oL70/UBm7Cim67btnJz sYWbKuora87lFEwF+Vl51AXNX3zLewzwj5nLiRG4afnKZuGgjsbLqXXAjYvlapXxCvvQ8Ax2n8z GQ8Z9Kre6AOrsUxWznkeQstDkCgNdWwTuvKx3w4u9eUAPmiGDFPUvfwaiDDFohSVUWsW2C9unk1 LppyPEroJS3yAMZTY90eXyo3POmIb9fLvjhtk9Az3g6hlY1Mx2XLCI8tjBLUpRMDjOsntcZiDf9 43EL0tDYVkzTtl1S65OBXSCUiUb76OqmI+SxYIy4qxGhEQ4GkVTR4VeEDA5zSiwEx4v0CiR38X/ QlJfDdCXDcKvH02LVZhkdpcyA6TieMx2isrV3csXi6YwbwGKdbF7mCR6I4QHAuCp1Dli3WZNrT8 aiy X-Received: by 2002:a05:6000:4687:b0:464:6ee:4fe1 with SMTP id ffacd0b85a97d-46406ee51d8mr3568612f8f.33.1781791386660; Thu, 18 Jun 2026 07:03:06 -0700 (PDT) Received: from localhost (p200300f65f47db04cea0a59ab11cac9f.dip0.t-ipconnect.de. [2003:f6:5f47:db04:cea0:a59a:b11c:ac9f]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-46289c3b3a3sm15325402f8f.30.2026.06.18.07.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 07:03:05 -0700 (PDT) From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= To: Marc Kleine-Budde , Vincent Mailhol , Rob Herring Cc: Jean-Michel Hautbois , linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net] can: flexcan: Fix probing for m68k/coldfire Date: Thu, 18 Jun 2026 16:01:47 +0200 Message-ID: <20260618140147.142489-2-u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2611; i=u.kleine-koenig@baylibre.com; h=from:subject; bh=263UnQqT7FgRjQmrIuWnRIN9Xzmjzy5Zozx+IEZgAgM=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBqM/pML1hFap/UgihwRJNb3DQPM0zusq3sfUm27 yKUYXEx1neJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCajP6TAAKCRCPgPtYfRL+ TqY2B/wPSLflQcf6bhsX8LkcflcqNm7174taCwQLa0R9I1TrLZQqw/AOowkuL/pwpTwGLrs84gR relE5J0uazE683Zv3i/JkOrMkiymyZUx5T5sOuunNvGrQhIRwJsk3fDxlfYrdQnPTf1O6wNk7TC Ev8kds36RmxGDCSzbhsYfvatVmoRtESYRP7bNPJ0j0xB9bmZpzM6Occ09QFN9eDgsYKsX2loH7d z30fZLMFcjkIVq2pglGw9xHrVAK695hDQ1TGxr1kbNzrgm6HVnxbgksjSI4m9H/hNSGOspTCKk/ IgD7zCruvvHll+ZJLNTAEsx2Xo+TASyfNvsOTuxJzxi0n0hl X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: 8bit 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) --- Hello, this is essentially v2 of https://lore.kernel.org/all/20260528094540.1867783-2-u.kleine-koenig@baylibre.com/, but that patch was intended to be a cleanup, while the discussion then revealed that there is a crash to be fixed. Jean-Michel Hautbois confirmed (off-list) that Marc's and my suspicion is true and probing the flexcan device provided by arch/m68k/coldfire/device.c indeed crashes. Best regards Uwe 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 f5d22c61503f..05b8ca72ca2a 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 & base-commit: e2cae00c05d196491c318196792297f2dfbaa02c -- 2.47.3