All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Jiale Yao <yaojiale02@163.com>
Cc: Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Shawn Guo <shawn.guo@linaro.org>,
	Huang Shijie <b32955@freescale.com>,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 2/3] bus: imx-weim: reject devices without match data
Date: Tue, 20 Oct 2026 11:06:46 -0500	[thread overview]
Message-ID: <ateRlt9Na6qDfjmT@SMW015318> (raw)
In-Reply-To: <20261020093637.1654161-3-yaojiale02@163.com>

On Tue, Oct 20, 2026 at 05:36:34PM +0800, Jiale Yao wrote:
> Platform driver_override can bind a device to this driver without a
> matching OF entry. In that case, device_get_match_data() returns NULL
> and weim_parse_dt() dereferences it while configuring the controller.
>
> Reject devices without match data before parsing the device tree.

This should never happen, if run to here, driver data is always existed.

Frank
>
> Fixes: 85bf6d4e4b10 ("drivers: bus: add a new driver for WEIM")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
>  drivers/bus/imx-weim.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
> index 87070155b057..3ecad0e453cc 100644
> --- a/drivers/bus/imx-weim.c
> +++ b/drivers/bus/imx-weim.c
> @@ -205,13 +205,17 @@ static int weim_timing_setup(struct device *dev, struct device_node *np,
>
>  static int weim_parse_dt(struct platform_device *pdev)
>  {
> -	const struct imx_weim_devtype *devtype = device_get_match_data(&pdev->dev);
> +	const struct imx_weim_devtype *devtype;
>  	int ret = 0, have_child = 0;
>  	struct device_node *child;
>  	struct weim_priv *priv;
>  	void __iomem *base;
>  	u32 reg;
>
> +	devtype = device_get_match_data(&pdev->dev);
> +	if (!devtype)
> +		return -ENODATA;
> +
>  	if (devtype == &imx50_weim_devtype) {
>  		ret = imx_weim_gpr_setup(pdev);
>  		if (ret)
> --
> 2.34.1
>
>


  reply	other threads:[~2026-10-20 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  9:36 [PATCH 0/3] bus: reject devices without platform match data Jiale Yao
2026-10-20  9:36 ` [PATCH 1/3] bus: imx-aipstz: reject devices without " Jiale Yao
2026-10-20 16:04   ` Frank Li
2026-10-20  9:36 ` [PATCH 2/3] bus: imx-weim: " Jiale Yao
2026-10-20 16:06   ` Frank Li [this message]
2026-10-20  9:36 ` [PATCH 3/3] bus: stm32-rifsc: reject debugfs setup " Jiale Yao

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=ateRlt9Na6qDfjmT@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=b32955@freescale.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    --cc=stable@vger.kernel.org \
    --cc=yaojiale02@163.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.