linux-stable/drivers/nvmem
Ahmad Fatoum 62c4532ebb nvmem: core: skip child nodes not matching binding
[ Upstream commit 0445efacec ]

The nvmem cell binding applies to all eeprom child nodes matching
"^.*@[0-9a-f]+$" without taking a compatible into account.

Linux drivers, like at24, are even more extensive and assume
_all_ at24 eeprom child nodes to be nvmem cells since e888d445ac
("nvmem: resolve cells from DT at registration time").

Since df5f3b6f53 ("dt-bindings: nvmem: stm32: new property for
data access"), the additionalProperties: True means it's Ok to have
other properties as long as they don't match "^.*@[0-9a-f]+$".

The barebox bootloader extends the MTD partitions binding to
EEPROM and can fix up following device tree node:

  &eeprom {
    partitions {
      compatible = "fixed-partitions";
    };
  };

This is allowed binding-wise, but drivers using nvmem_register()
like at24 will fail to parse because the function expects all child
nodes to have a reg property present. This results in the whole
EEPROM driver probe failing despite the device tree being correct.

Fix this by skipping nodes lacking a reg property instead of
returning an error. This effectively makes the drivers adhere
to the binding because all nodes with a unit address must have
a reg property and vice versa.

Fixes: e888d445ac ("nvmem: resolve cells from DT at registration time").
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210129171430.11328-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-04 10:26:37 +01:00
..
bcm-ocotp.c
core.c nvmem: core: skip child nodes not matching binding 2021-03-04 10:26:37 +01:00
imx-iim.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 460 2019-06-19 17:09:09 +02:00
imx-ocotp-scu.c nvmem: imx: add i.MX8QM platform support 2019-08-18 12:56:53 +02:00
imx-ocotp.c nvmem: imx-ocotp: reset error status on probe 2019-12-31 16:44:42 +01:00
Kconfig nvmem: Broaden the selection of NVMEM_SNVS_LPGPR 2019-06-19 19:35:51 +02:00
lpc18xx_eeprom.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lpc18xx_otp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Makefile nvmem: imx: add i.MX8 nvmem driver 2019-06-19 19:35:51 +02:00
meson-efuse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
meson-mx-efuse.c nvmem: meson-mx-efuse: allow reading data smaller than word_size 2019-08-18 12:56:52 +02:00
mtk-efuse.c
mxs-ocotp.c nvmem: mxs-ocotp: update MODULE_AUTHOR() email address 2019-08-18 12:56:52 +02:00
nvmem-sysfs.c nvmem: check for NULL reg_read and reg_write before dereferencing 2020-04-08 09:08:42 +02:00
nvmem.h
qfprom.c nvmem: qfprom: remove incorrect write support 2020-06-10 20:24:57 +02:00
rave-sp-eeprom.c
rockchip-efuse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295 2019-06-05 17:36:38 +02:00
sc27xx-efuse.c
snvs_lpgpr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
stm32-romem.c
sunxi_sid.c nvmem: sunxi_sid: fix A64 SID controller support 2019-08-18 12:56:52 +02:00
uniphier-efuse.c
vf610-ocotp.c
zynqmp_nvmem.c