diff options
author | Wolfram Sang <wsa-dev@sang-engineering.com> | 2016-07-09 06:35:01 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-07-14 15:07:29 +0200 |
commit | 84d0b61773c7af077be71f74f0d7fea65af7f9b0 (patch) | |
tree | 21561b6187544d23e7d31efdd9ea0e34eb743b1c /drivers/i2c | |
parent | i2c: improve error messages in i2c_register_adapter() (diff) | |
download | linux-84d0b61773c7af077be71f74f0d7fea65af7f9b0.tar.xz linux-84d0b61773c7af077be71f74f0d7fea65af7f9b0.zip |
i2c: add error message when obtaining idr fails
Fix some whitespace issues while here.
Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 8e07e3be4880..1a91b5173104 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1684,13 +1684,12 @@ out_list: */ static int __i2c_add_numbered_adapter(struct i2c_adapter *adap) { - int id; + int id; mutex_lock(&core_lock); - id = idr_alloc(&i2c_adapter_idr, adap, adap->nr, adap->nr + 1, - GFP_KERNEL); + id = idr_alloc(&i2c_adapter_idr, adap, adap->nr, adap->nr + 1, GFP_KERNEL); mutex_unlock(&core_lock); - if (id < 0) + if (WARN(id < 0, "couldn't get idr")) return id == -ENOSPC ? -EBUSY : id; return i2c_register_adapter(adap); @@ -1727,7 +1726,7 @@ int i2c_add_adapter(struct i2c_adapter *adapter) id = idr_alloc(&i2c_adapter_idr, adapter, __i2c_first_dynamic_bus_num, 0, GFP_KERNEL); mutex_unlock(&core_lock); - if (id < 0) + if (WARN(id < 0, "couldn't get idr")) return id; adapter->nr = id; |