Skip to content

Commit 0656db9

Browse files
committed
base: soc: Let soc_device_match() return no match when called too early
If soc_device_match() is called before the SoC bus has been registered, bus_for_each_dev() returns -EINVAL, which is considered a match, as it is non-zero. While calling soc_device_match() too early can be considered an integration mistake, returning a match is counter-intuitive: soc_device_match() is typically used to handle quirks, i.e. to deviate from the default path. Hence add a check to abort checking and return no match instead. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Arnd Bergmann <arnd@arndb.de>
1 parent c470abd commit 0656db9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/base/soc.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ const struct soc_device_attribute *soc_device_match(
230230
break;
231231
ret = bus_for_each_dev(&soc_bus_type, NULL, (void *)matches,
232232
soc_device_match_one);
233+
if (ret < 0)
234+
return NULL;
233235
if (!ret)
234236
matches++;
235237
else

0 commit comments

Comments
 (0)