It is useless to create a new mapping just to detach it immediately.
Use the newly added i2c_atr_find_mapping_by_addr() function to avoid it,
and exit without logging an error if not found.
Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
mutex_lock(&chan->alias_pairs_lock);
- c2a = i2c_atr_get_mapping_by_addr(chan, addr);
+ c2a = i2c_atr_find_mapping_by_addr(chan, addr);
if (!c2a) {
- /* This should never happen */
- dev_warn(atr->dev, "Unable to find address mapping\n");
mutex_unlock(&chan->alias_pairs_lock);
return;
}