Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1596288 > unrolled thread
| Started by | Geert Uytterhoeven <geert+renesas@glider.be> |
|---|---|
| First post | 2017-03-09 19:20 +0100 |
| Last post | 2017-03-13 13:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/2] [RFC] base: soc: Let soc_device_match() return no match when called too early Geert Uytterhoeven <geert+renesas@glider.be> - 2017-03-09 19:20 +0100
Re: [PATCH 1/2] [RFC] base: soc: Let soc_device_match() return no match when called too early Arnd Bergmann <arnd@arndb.de> - 2017-03-13 13:40 +0100
| From | Geert Uytterhoeven <geert+renesas@glider.be> |
|---|---|
| Date | 2017-03-09 19:20 +0100 |
| Subject | [PATCH 1/2] [RFC] base: soc: Let soc_device_match() return no match when called too early |
| Message-ID | <tjaPo-rT-17@gated-at.bofh.it> |
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() 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> --- Should this use WARN_ONCE()? --- drivers/base/soc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/soc.c b/drivers/base/soc.c index dc26e5949a320223..50033081834a9ccd 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 -- 2.7.4
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-03-13 13:40 +0100 |
| Subject | Re: [PATCH 1/2] [RFC] base: soc: Let soc_device_match() return no match when called too early |
| Message-ID | <tkxqy-uQ-29@gated-at.bofh.it> |
| In reply to | #1596288 |
On Thu, Mar 9, 2017 at 7:18 PM, Geert Uytterhoeven <geert+renesas@glider.be> wrote: > 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() 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> > Should this use WARN_ONCE()? I wouldn't mind that either, but your current version seems sufficient.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web