Re: [PATCH] hwmon: (w83793) remove vrm sysfs file on probe failure

From: Guenter Roeck

Date: Tue Jun 16 2026 - 19:09:29 EST


On Mon, Jun 15, 2026 at 02:48:06PM +0800, Pengpeng Hou wrote:
> w83793_probe() creates the vrm sysfs file after creating the VID files
> when VID support is present.
>
> The normal remove path deletes vrm, but the probe error path only
> removes the sensor, SDA, VID, fan, PWM and temperature files. A later
> probe failure can therefore leave vrm behind after the driver data has
> been freed.
>
> Remove vrm in the probe error path next to the VID files, matching the
> normal remove path.
>
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>

Applied, but this is a typical case of fixing a minor issue while ignoring
all the big problems in the code. That entire driver would need an overhaul
to fix it for good (I am sure that Sashiko did not report all its problems),
but that only makes sense if the result is tested on real hardware. Please
leave it alone in the future unless you have real hardware, and then consider
converting it to use the latest watchdog and hwmon APIs.

Thanks,
Guenter

> ---
> drivers/hwmon/w83793.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
> index 24772cfbecb3..8726c5fe8a95 100644
> --- a/drivers/hwmon/w83793.c
> +++ b/drivers/hwmon/w83793.c
> @@ -1917,6 +1917,7 @@ static int w83793_probe(struct i2c_client *client)
>
> for (i = 0; i < ARRAY_SIZE(w83793_vid); i++)
> device_remove_file(dev, &w83793_vid[i].dev_attr);
> + device_remove_file(dev, &dev_attr_vrm);
>
> for (i = 0; i < ARRAY_SIZE(w83793_left_fan); i++)
> device_remove_file(dev, &w83793_left_fan[i].dev_attr);