Skip to contentSkip to conversation

mfd: core: Restore error-free return for dt-disabled devices

PATCH New Paul Kocialkowski 1 participant 1 message Oct 30, 2020 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: core: Restore error-free return for dt-disabled devices

When adding devices via mfd (mfd_add_device), a check on the device-tree status of the device was performed to gracefully handle disabled devices without errors.

This was done with a check using of_device_is_available, that was recently moved to the mfd_match_of_node_to_dev function (by returning -ENODEV). However, no specific case was added to handle -ENODEV, so it was handled like any error.

At the end of the day, this causes the mfd_add_devices process to fail as soon as one device is marked disabled. This is quite problematic and definitely not what we want.

Introduce a special case to handle -ENODEV gracefully and restore original behavior.

Fixes 466a62d7642f ("mfd: core: Make a best effort attempt to match

devices with the correct of_nodes")

---
 drivers/mfd/mfd-core.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mfd/mfd-core.c +7 -0
index c3651f06684f..be9900866f2d 100644
@@ -215,6 +215,13 @@ static int mfd_add_device(struct device *parent, int id,
 				ret = mfd_match_of_node_to_dev(pdev, np, cell);
 				if (ret == -EAGAIN)
 					continue;
+
+				/* Ignore 'disabled' devices error free */
+				if (ret == -ENODEV) {
+					ret = 0;
+					goto fail_alias;
+				}
+
 				if (ret)
 					goto fail_alias;
 
Signature · 1 line
2.28.0