Re: [PATCH 1/3] bus: imx-aipstz: reject devices without match data

From: Frank Li

Date: Tue Oct 20 2026 - 12:05:40 EST


On Tue, Oct 20, 2026 at 05:36:33PM +0800, Jiale Yao wrote:
> Platform driver_override can bind a device to this driver without a
> matching OF entry. In that case, of_device_get_match_data() returns
> NULL and imx_aipstz_apply_default() dereferences it.
>
> Reject devices without match data before applying the default
> configuration.

It should never happen. if run to here, of_device_get_match_data() will
return validate driver data.

Frank

>
> Fixes: 796cba2dd4d9 ("bus: add driver for IMX AIPSTZ bridge")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
> ---
> drivers/bus/imx-aipstz.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c
> index 83371e5b35a2..9f74cbcd47ff 100644
> --- a/drivers/bus/imx-aipstz.c
> +++ b/drivers/bus/imx-aipstz.c
> @@ -61,6 +61,8 @@ static int imx_aipstz_probe(struct platform_device *pdev)
> "failed to get/ioremap AC memory\n");
>
> data->default_cfg = of_device_get_match_data(&pdev->dev);
> + if (!data->default_cfg)
> + return -ENODATA;
>
> imx_aipstz_apply_default(data);
>
> --
> 2.34.1
>
>