[PATCH] Input: mtk-pmic-keys: Fix null pointer dereference when no compatible data

Dmitry Torokhov dmitry.torokhov at gmail.com
Mon Jun 30 08:25:00 PDT 2025


On Mon, Jun 30, 2025 at 04:06:53PM +0200, AngeloGioacchino Del Regno wrote:
> Il 30/06/25 16:03, Louis-Alexis Eyraud ha scritto:

[... snip ...]

> > @@ -316,6 +316,9 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev)
> >   	const struct of_device_id *of_id =
> >   		of_match_device(of_mtk_pmic_keys_match_tbl, &pdev->dev);
> > +	if (!of_id)
> > +		return -EINVAL;
> 
> Please, change this to `return -ENODEV;`

No, this definitely should not be a "silent" error because it indicates
there is something wrong with the kernel.

Stepping back, why do we even enter mtk_pmic_keys_probe() if there is
not a matching OF ID? Are there any other patches that are not upstream?

Thanks.

-- 
Dmitry



More information about the Linux-mediatek mailing list