Skip to contentSkip to conversation

hwmon: (adm9240) Fix writes into inX_max attributes

PATCH In review Guenter Roeck 2 participants 2 messages May 12, 2021 – May 13, 2021 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (adm9240) Fix writes into inX_max attributes

When converting the driver to use the devm_hwmon_device_register_with_info API, the wrong register was selected when writing into inX_max attributes. Fix it.

Fixes 124b7e34a5a6 ("hwmon: (adm9240) Convert to devm_hwmon_device_register_with_info API")
---
 drivers/hwmon/adm9240.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/adm9240.c +1 -1
index 5677263bcf0d..483cd757abd3 100644
@@ -485,7 +485,7 @@ static int adm9240_in_write(struct device *dev, u32 attr, int channel, long val)
 		reg = ADM9240_REG_IN_MIN(channel);
 		break;
 	case hwmon_in_max:
-		reg = ADM9240_REG_IN(channel);
+		reg = ADM9240_REG_IN_MAX(channel);
 		break;
 	default:
 		return -EOPNOTSUPP;
Signature · 1 line
2.25.1
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Guenter Roeck

When converting the driver to use the devm_hwmon_device_register_with_info API, the wrong register was selected when writing into inX_max attributes. Fix it.

Fixes 124b7e34a5a6 ("hwmon: (adm9240) Convert to devm_hwmon_device_register_with_info API")

Works for me.

Quoted 17 lines
---
  drivers/hwmon/adm9240.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/adm9240.c +1 -1
index 5677263bcf0d..483cd757abd3 100644
@@ -485,7 +485,7 @@ static int adm9240_in_write(struct device *dev, u32 attr, int channel, long val)
  		reg = ADM9240_REG_IN_MIN(channel);
  		break;
  	case hwmon_in_max:
-		reg = ADM9240_REG_IN(channel);
+		reg = ADM9240_REG_IN_MAX(channel);
  		break;
  	default:
  		return -EOPNOTSUPP;