Re: [PATCH 2/2] leds: flash: s2m: wire up of_match_table in platform driver
[email protected] Tue, 21 Jul 2026 05:57:25 +0000
| Newsgroups | org.kernel.vger.linux-leds |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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/[email protected]?part=2