[PATCH] wifi: mt76: use IS_REACHABLE(CONFIG_MTD) in mt76_get_of_data_from_mtd()
Pengpeng Hou
hppiscas at 163.com
Thu Dec 3 18:27:05 PST 2026
mt76 skips the MTD source for EEPROM data if MTD is modular, including
when the consuming driver is a module. A board describing its EEPROM in
an MTD partition then cannot use that lookup path.
Keep supporting deployed device trees with mediatek,mtd-eeprom. Use
IS_REACHABLE so built-in mt76 does not call into a module-only MTD
provider. Leave the other EEPROM sources and their lookup order alone.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
Signed-off-by: Pengpeng Hou <hppiscas at 163.com>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built eeprom.o on x86-64 with GCC 11.4 and W=1 (CONFIG_MT76_CORE=m,
CONFIG_MTD=m). No runtime or hardware test was performed.
drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 93552f6f7f34043559209a1770bcd9266ae1cf09..63a3d0d6ca948ff2dbe160c498885471023582b9 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -37,7 +37,7 @@ static int mt76_get_of_eeprom_data(struct mt76_dev *dev, void *eep, int len)
int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len)
{
-#ifdef CONFIG_MTD
+#if IS_REACHABLE(CONFIG_MTD)
struct device_node *np = dev->dev->of_node;
struct mtd_info *mtd;
const __be32 *list;
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
More information about the linux-arm-kernel
mailing list