Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: kr494167@gmail.com
Cc: linux-leds@vger.kernel.org, lee@kernel.org
Subject: Re: [PATCH 2/2] leds: flash: s2m: wire up of_match_table in platform driver
Date: Tue, 21 Jul 2026 05:57:25 +0000	[thread overview]
Message-ID: <20260721055725.8240A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260721054846.34318-3-kr494167@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Adding `.of_match_table` exposes the driver to standalone DT probing, breaking the assumption that it is strictly instantiated as an MFD cell, leading to a NULL pointer dereference or type confusion.
- [Low] The commit message violates the subsystem's capitalization guidelines for the description.
--

--- Patch [2]: [PATCH 2/2] leds: flash: s2m: wire up of_match_table in platform driver ---
commit 2a98fe49f1f26ddb2bdb4a505ce05edc54a427b5
Author: surendra <kr494167@gmail.com>

leds: flash: s2m: wire up of_match_table in platform driver

This patch wires up the s2m_fled_of_match_table to the platform driver's
of_match_table field to allow DT-based probing and module auto-loading.

> leds: flash: s2m: wire up of_match_table in platform driver

[Severity: Low]
This isn't a bug, but the LED subsystem guidelines request capitalizing the
description after the subsystem prefix. Should "wire" be "Wire"?

> diff --git a/drivers/leds/flash/leds-s2m-flash.c b/drivers/leds/flash/leds-s2m-flash.c
> index 6ee8db094611a..2373a70d83ebd 100644
> --- a/drivers/leds/flash/leds-s2m-flash.c
> +++ b/drivers/leds/flash/leds-s2m-flash.c
> @@ -339,6 +339,7 @@ MODULE_DEVICE_TABLE(of, s2m_fled_of_match_table);
>  static struct platform_driver s2m_fled_driver = {
>  	.driver = {
>  		.name = "s2m-flash",
> +		.of_match_table = s2m_fled_of_match_table,

[Severity: High]
Does adding the of_match_table expose the probe function to a NULL pointer 
dereference if probed standalone via a device tree?

Looking at s2m_fled_probe(), it assumes it is always instantiated strictly as
an MFD cell:

drivers/leds/flash/leds-s2m-flash.c:s2m_fled_probe() {
    struct sec_pmic_dev *ddata = dev_get_drvdata(dev->parent);
    ...
    ret = s2mu005_fled_init(led, dev, ddata->regmap_pmic, MAX_CHANNELS);

If this driver is bound directly via a device tree node at the root of the
device tree or under a generic bus, dev->parent won't be the MFD parent.
This means dev_get_drvdata(dev->parent) could return NULL or unrelated data,
leading to a crash when accessing ddata->regmap_pmic.

>  	},
>  	.probe = s2m_fled_probe,
>  	.id_table = s2m_fled_id_table,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721054846.34318-1-kr494167@gmail.com?part=2

      reply	other threads:[~2026-07-21  5:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  5:48 [PATCH 0/2] leds: s2m: wire up missing of_match_table in platform drivers kr494167
2026-07-21  5:48 ` [PATCH 1/2] leds: rgb: s2m: wire up of_match_table in platform driver kr494167
2026-07-21  5:58   ` sashiko-bot
2026-07-21  5:48 ` [PATCH 2/2] leds: flash: " kr494167
2026-07-21  5:57   ` sashiko-bot [this message]

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=20260721055725.8240A1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kr494167@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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