* [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe()
@ 2022-02-05 9:20 Dan Carpenter
2022-02-05 9:59 ` Eugene Shalygin
2022-02-05 17:52 ` Guenter Roeck
0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-02-05 9:20 UTC (permalink / raw)
To: Eugene Shalygin; +Cc: Jean Delvare, Guenter Roeck, linux-hwmon, kernel-janitors
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/hwmon/asus-ec-sensors.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index 7285334c7d80..cb266ba30c97 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -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),
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe()
2022-02-05 9:20 [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe() Dan Carpenter
@ 2022-02-05 9:59 ` Eugene Shalygin
2022-02-05 17:55 ` Guenter Roeck
2022-02-07 7:10 ` Dan Carpenter
2022-02-05 17:52 ` Guenter Roeck
1 sibling, 2 replies; 5+ messages in thread
From: Eugene Shalygin @ 2022-02-05 9:59 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Jean Delvare, Guenter Roeck, linux-hwmon, kernel-janitors
On Sat, 5 Feb 2022 at 10:20, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe()
2022-02-05 9:20 [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe() Dan Carpenter
2022-02-05 9:59 ` Eugene Shalygin
@ 2022-02-05 17:52 ` Guenter Roeck
1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-02-05 17:52 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Eugene Shalygin, Jean Delvare, linux-hwmon, kernel-janitors
On Sat, Feb 05, 2022 at 12:20:15PM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/asus-ec-sensors.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
> index 7285334c7d80..cb266ba30c97 100644
> --- a/drivers/hwmon/asus-ec-sensors.c
> +++ b/drivers/hwmon/asus-ec-sensors.c
> @@ -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),
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe()
2022-02-05 9:59 ` Eugene Shalygin
@ 2022-02-05 17:55 ` Guenter Roeck
2022-02-07 7:10 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2022-02-05 17:55 UTC (permalink / raw)
To: Eugene Shalygin, Dan Carpenter; +Cc: Jean Delvare, linux-hwmon, kernel-janitors
On 2/5/22 01:59, Eugene Shalygin wrote:
> On Sat, 5 Feb 2022 at 10:20, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>
>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe()
2022-02-05 9:59 ` Eugene Shalygin
2022-02-05 17:55 ` Guenter Roeck
@ 2022-02-07 7:10 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-02-07 7:10 UTC (permalink / raw)
To: Eugene Shalygin; +Cc: Jean Delvare, Guenter Roeck, linux-hwmon, kernel-janitors
On Sat, Feb 05, 2022 at 10:59:10AM +0100, Eugene Shalygin wrote:
> On Sat, 5 Feb 2022 at 10:20, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-07 7:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-05 9:20 [PATCH] hwmon: (asus-ec-sensors) fix a typo in asus_ec_probe() Dan Carpenter
2022-02-05 9:59 ` Eugene Shalygin
2022-02-05 17:55 ` Guenter Roeck
2022-02-07 7:10 ` Dan Carpenter
2022-02-05 17:52 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.