Skip to contentSkip to conversation

hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe()

PATCH Applied Dan Carpenter 3 participants 5 messages Feb 5, 2022 – Feb 7, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe()

There is no such struct as "asus_ec_sensors", it was supposed to be "ec_sensors_data". This typo does not affect either build or runtime.

Fixes c4b1687d6897 ("hwmon: (asus-ec-sensors) add driver for ASUS EC")
---
 drivers/hwmon/asus-ec-sensors.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/asus-ec-sensors.c +1 -1
index 7285334c7d80..cb266ba30c97 100644
@@ -653,7 +653,7 @@ static int __init configure_sensor_setup(struct device *dev)
 
 static int __init asus_ec_probe(struct platform_device *pdev)
 {
-	struct asus_ec_sensors *state;
+	struct ec_sensors_data *state;
 	int status = 0;
 
 	state = devm_kzalloc(&pdev->dev, sizeof(struct ec_sensors_data),
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 3 lines · Dan Carpenter

There is no such struct as "asus_ec_sensors", it was supposed to be "ec_sensors_data". This typo does not affect either build or runtime.

Thank you for the fix! Perhaps you could also replace the sizeof argument below with *state to make the compiler check the declaration type?

Eugene

maintainer Applied
#4 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

There is no such struct as "asus_ec_sensors", it was supposed to be "ec_sensors_data". This typo does not affect either build or runtime.

Fixes c4b1687d6897 ("hwmon: (asus-ec-sensors) add driver for ASUS EC")

Applied.

Thanks,
Guenter

Quoted 17 lines
---
 drivers/hwmon/asus-ec-sensors.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/asus-ec-sensors.c +1 -1
index 7285334c7d80..cb266ba30c97 100644
@@ -653,7 +653,7 @@ static int __init configure_sensor_setup(struct device *dev)
 
 static int __init asus_ec_probe(struct platform_device *pdev)
 {
-	struct asus_ec_sensors *state;
+	struct ec_sensors_data *state;
 	int status = 0;
 
 	state = devm_kzalloc(&pdev->dev, sizeof(struct ec_sensors_data),
maintainer
#2 lore raw
In reply to Eugene Shalygin
Quoted 9 lines · Eugene Shalygin
Quoted 3 lines · Dan Carpenter

There is no such struct as "asus_ec_sensors", it was supposed to be "ec_sensors_data". This typo does not affect either build or runtime.

Thank you for the fix! Perhaps you could also replace the sizeof argument below with *state to make the compiler check the declaration type?

The weirdness is coming from the fact that the probe function is really a shim and all work is done in configure_sensor_setup(). A more conventional implementation would not have that separate function. Changing the above won't change that and on its own adds little value. I applied the patch as-is.

Guenter

#3 lore raw
In reply to Eugene Shalygin
Quoted 8 lines · Eugene Shalygin
Quoted 3 lines · Dan Carpenter

There is no such struct as "asus_ec_sensors", it was supposed to be "ec_sensors_data". This typo does not affect either build or runtime.

Thank you for the fix! Perhaps you could also replace the sizeof argument below with *state to make the compiler check the declaration type?

No one likes resending patches especially for style issues that they didn't introduce.

The sizeof() is how I noticed this, because I look at it whenever someone allocates a different size or different type struct from expected. I did want to change it, but it wasn't necessary and I couldn't find a compelling excuse to override the original author's style choices. ;)

The kind of bugs where someone allocates the wrong size seldom reach real users. Normally they would show up in your testing. KASan is very good at detecting them. And we have a bunch of static analysis around this issue as well. It would be interesting to do a proper study on this to look at bugs which only changed a sizeof() and see the time since the Fixes tag.

regards,
dan carpenter