diff options
-rw-r--r-- | drivers/i2c/i2c-core.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 975cb647da10..45e2cdf54736 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -288,9 +288,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) | |||
288 | { | 288 | { |
289 | struct list_head *item; | 289 | struct list_head *item; |
290 | struct i2c_adapter *adapter; | 290 | struct i2c_adapter *adapter; |
291 | int res = 0; | 291 | int res; |
292 | |||
293 | mutex_lock(&core_lists); | ||
294 | 292 | ||
295 | /* add the driver to the list of i2c drivers in the driver core */ | 293 | /* add the driver to the list of i2c drivers in the driver core */ |
296 | driver->driver.owner = owner; | 294 | driver->driver.owner = owner; |
@@ -298,8 +296,10 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) | |||
298 | 296 | ||
299 | res = driver_register(&driver->driver); | 297 | res = driver_register(&driver->driver); |
300 | if (res) | 298 | if (res) |
301 | goto out_unlock; | 299 | return res; |
302 | 300 | ||
301 | mutex_lock(&core_lists); | ||
302 | |||
303 | list_add_tail(&driver->list,&drivers); | 303 | list_add_tail(&driver->list,&drivers); |
304 | pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); | 304 | pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); |
305 | 305 | ||
@@ -311,9 +311,8 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) | |||
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | out_unlock: | ||
315 | mutex_unlock(&core_lists); | 314 | mutex_unlock(&core_lists); |
316 | return res; | 315 | return 0; |
317 | } | 316 | } |
318 | EXPORT_SYMBOL(i2c_register_driver); | 317 | EXPORT_SYMBOL(i2c_register_driver); |
319 | 318 | ||