diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2016-03-14 09:41:52 (GMT) |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-03-14 17:17:25 (GMT) |
commit | b980a26d02d1f54be31346666222304fcd27ea33 (patch) | |
tree | 315d6c0f33ca6d0eae6f8eda2610d26cde4883e8 /drivers/i2c | |
parent | 34b57f40a6a27f45dfa51b46cdbc96b7031652a7 (diff) | |
download | linux-b980a26d02d1f54be31346666222304fcd27ea33.tar.xz |
i2c: immediately mark ourselves as registered
Mark the i2c bus as registered right after the the bus_register call,
not at the end of init. Otherwise, we can't register our own dummy
driver.
Reported-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Fixes: 95026658c46ea2 ("i2c: do not use internal data from driver core")
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index f4726cd..0f2f848 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -2105,6 +2105,9 @@ static int __init i2c_init(void) retval = bus_register(&i2c_bus_type); if (retval) return retval; + + is_registered = true; + #ifdef CONFIG_I2C_COMPAT i2c_adapter_compat_class = class_compat_register("i2c-adapter"); if (!i2c_adapter_compat_class) { @@ -2119,7 +2122,6 @@ static int __init i2c_init(void) if (IS_ENABLED(CONFIG_OF_DYNAMIC)) WARN_ON(of_reconfig_notifier_register(&i2c_of_notifier)); - is_registered = true; return 0; class_err: @@ -2127,6 +2129,7 @@ class_err: class_compat_unregister(i2c_adapter_compat_class); bus_err: #endif + is_registered = false; bus_unregister(&i2c_bus_type); return retval; } |