Message ID | 20250428102516.933571-5-demonsingur@gmail.com |
---|---|
State | New |
Headers | show |
Series | i2c: atr: allow usage of nested ATRs | expand |
On Mon, 28 Apr 2025 13:25:09 +0300 Cosmin Tanislav <demonsingur@gmail.com> wrote: > 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>
diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c index 184c57c31e60..42f433846f63 100644 --- a/drivers/i2c/i2c-atr.c +++ b/drivers/i2c/i2c-atr.c @@ -586,10 +586,8 @@ static void i2c_atr_detach_addr(struct i2c_adapter *adapter, 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; }
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> --- drivers/i2c/i2c-atr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)