Re: [PATCH v2 5/9] i2c: atr: do not create mapping in detach_addr()
From: Romain Gantois
Date: Thu Feb 27 2025 - 08:35:54 EST
On mardi 25 février 2025 12:39:33 heure normale d’Europe centrale Cosmin
Tanislav 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@xxxxxxxxx>
> ---
> drivers/i2c/i2c-atr.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c
> index 9c4e9e8ec802..b62aa6ae452e 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;
> }
Reviewed-by: Romain Gantois <romain.gantois@xxxxxxxxxxx>
Attachment:
signature.asc
Description: This is a digitally signed message part.