@@ -1150,6 +1150,17 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
(msgs[ret].flags & I2C_M_RECV_LEN) ? "+" : "");
}
#endif
+ for (ret = 0; ret < num; ret++) {
+ if (msgs[ret].flags & I2C_M_TEN) {
+ /* XXX what"s I2C_M_TEN range */
+ if (msgs[ret].addr < 0x03 || msgs[ret].addr > 0x377)
+ return -EINVAL;
+ }
+ else {
+ if (msgs[ret].addr < 0x03 || msgs[ret].addr > 0x77)
+ return -EINVAL;
+ }
+ }
if (in_atomic() || irqs_disabled()) {
ret = rt_mutex_trylock(&adap->bus_lock);