summaryrefslogtreecommitdiffstats
path: root/drivers/base/soc.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2017-03-09 12:28:18 +0100
committerGeert Uytterhoeven <geert+renesas@glider.be>2017-03-29 21:43:22 +0200
commit0656db9e445a12122f76e259ab89d256cb07a0ad (patch)
tree55cedd9b1e3b998ea15837ce8f836556ea33259d /drivers/base/soc.c
parentc470abd4fde40ea6a0846a2beab642a578c0b8cd (diff)
downloadlinux-0656db9e445a12122f76e259ab89d256cb07a0ad.tar.bz2
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>
Diffstat (limited to 'drivers/base/soc.c')
-rw-r--r--drivers/base/soc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index dc26e5949a32..50033081834a 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -230,6 +230,8 @@ const struct soc_device_attribute *soc_device_match(
break;
ret = bus_for_each_dev(&soc_bus_type, NULL, (void *)matches,
soc_device_match_one);
+ if (ret < 0)
+ return NULL;
if (!ret)
matches++;
else