i2c: mlxcpld: Fix criteria for frequency setting
authorVadim Pasternak <vadimp@nvidia.com>
Mon, 23 Aug 2021 14:45:01 +0000 (17:45 +0300)
committerWolfram Sang <wsa@kernel.org>
Mon, 4 Oct 2021 19:56:13 +0000 (21:56 +0200)
Value for getting frequency capability wrongly has been taken from
register offset instead of register value.

Fixes: 66b0c2846ba8 ("i2c: mlxcpld: Add support for I2C bus frequency setting")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-mlxcpld.c

index 4e0b7c2..6d41c3d 100644 (file)
@@ -495,7 +495,7 @@ mlxcpld_i2c_set_frequency(struct mlxcpld_i2c_priv *priv,
                return err;
 
        /* Set frequency only if it is not 100KHz, which is default. */
-       switch ((data->reg & data->mask) >> data->bit) {
+       switch ((regval & data->mask) >> data->bit) {
        case MLXCPLD_I2C_FREQ_1000KHZ:
                freq = MLXCPLD_I2C_FREQ_1000KHZ_SET;
                break;