v2: The original conversion accidentally dropped a call to
i2c_register_adapter() in i2c_add_numbered_adapter() leaving @adap
uninitialized and unregistered. Reported by Mark Brown. Fix it.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Wolfram Sang <wolfram@the-dreams.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
if (adap->nr == -1) /* -1 means dynamically assign bus id */
return i2c_add_adapter(adap);
+ if (adap->nr & ~MAX_IDR_MASK)
+ return -EINVAL;
mutex_lock(&core_lock);
id = idr_alloc(&i2c_adapter_idr, adap, adap->nr, adap->nr + 1,
mutex_unlock(&core_lock);
if (id < 0)
return id == -ENOSPC ? -EBUSY : id;
- return 0;
+ return i2c_register_adapter(adap);
}
EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter);