mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	kernel@collabora.com, linux-input@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] Input: mtk-pmic-keys: Fix null pointer dereference when no compatible data
Date: Mon, 30 Jun 2025 15:59:46 -0400	[thread overview]
Message-ID: <48f573941d64217240f4750534e17faf4af0e3f6.camel@collabora.com> (raw)
In-Reply-To: <d373gpdyqejppdysdbb4k6aat5i33epnqsebxdkjbrgfwsnqtm@43si4kmjvsmq>

On Mon, 2025-06-30 at 08:25 -0700, Dmitry Torokhov wrote:
> 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?

I'm guessing it's because the driver can be probed by a parent MFD
driver, drivers/mfd/mt6397-core.c, and the compatibles defined in the
MFD don't necessarily match the ones in the pmic-keys driver, for
instance 'mediatek,mt6359-keys' is only listed in the MFD. Adding the
missing compatibles to the pmic-keys driver should fix this.


-- 
Thanks,

Nícolas

  reply	other threads:[~2025-06-30 20:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 14:03 Louis-Alexis Eyraud
2025-06-30 14:06 ` AngeloGioacchino Del Regno
2025-06-30 15:25   ` Dmitry Torokhov
2025-06-30 19:59     ` Nícolas F. R. A. Prado [this message]
2025-06-30 23:03       ` Dmitry Torokhov
2025-06-30 20:18 ` Easwar Hariharan
2025-06-30 21:46   ` Dmitry Torokhov
2025-06-30 22:23     ` Easwar Hariharan
2025-06-30 23:06       ` Dmitry Torokhov

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=48f573941d64217240f4750534e17faf4af0e3f6.camel@collabora.com \
    --to=nfraprado@collabora.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=louisalexis.eyraud@collabora.com \
    --cc=matthias.bgg@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®