hwmon: (nct6775) Fix incorrect parenthesization in nct6775_write_fan_div()

Commit 4ef2774511 ("hwmon: (nct6775) Convert register access to
regmap API") fumbled the shifting & masking of the fan_div values such
that odd-numbered fan divisors would always be set to zero.  Fix it so
that we actually OR in the bits we meant to.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Fixes: 4ef2774511 ("hwmon: (nct6775) Convert register access to regmap API")
Cc: stable@kernel.org # v5.19+
Link: https://lore.kernel.org/r/20230102212857.5670-1-zev@bewilderbeest.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Zev Weiss 2023-01-02 13:28:57 -08:00 committed by Guenter Roeck
parent ca8fd8c16a
commit 2fbb848b65
1 changed files with 1 additions and 1 deletions

View File

@ -1150,7 +1150,7 @@ static int nct6775_write_fan_div(struct nct6775_data *data, int nr)
if (err)
return err;
reg &= 0x70 >> oddshift;
reg |= data->fan_div[nr] & (0x7 << oddshift);
reg |= (data->fan_div[nr] & 0x7) << oddshift;
return nct6775_write_value(data, fandiv_reg, reg);
}