Re: [PATCH 1/6] platform/x86: msi-wmi-platform: Move guard out of switch in platform_write()
Ilpo Järvinen <[email protected]>
| Newsgroups | org.kernel.vger.linux-hwmon,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.platform-driver-x86 |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 3 Aug 2026, Derek J. Clark wrote: > The ML patch set uses a guard within a switch case that violates cleanup > rules. Move the guard outside the switch so all return paths are covered. > > Signed-off-by: Derek J. Clark <[email protected]> > --- > drivers/platform/x86/msi-wmi-platform.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c > index dfb65ac8fbf6..33acd448f674 100644 > --- a/drivers/platform/x86/msi-wmi-platform.c > +++ b/drivers/platform/x86/msi-wmi-platform.c > @@ -675,11 +675,11 @@ static int msi_wmi_platform_write(struct device *dev, enum hwmon_sensor_types ty > u8 buffer[32] = { }; > int ret; > > + guard(mutex)(&data->wmi_lock); > switch (type) { > case hwmon_pwm: > switch (attr) { > case hwmon_pwm_enable: > - guard(mutex)(&data->wmi_lock); While I cannot see the code easily, one could also add braces to inside the case to avoid this problem. > > buffer[0] = MSI_PLATFORM_AP_SUBFEATURE_FAN_MODE; > ret = msi_wmi_platform_query_unlocked( > -- i.