Skip to content

Commit 15176b8

Browse files
kaushlenrafaeljw
authored andcommitted
thermal: int340x: Fix sysfs group leak on DLVR registration failure
When DLVR sysfs group creation fails in proc_thermal_rfim_add(), the function returns immediately without cleaning up the FIVR group that may have been created earlier. Add proper error unwinding to remove the FIVR group before returning failure. Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://patch.msgid.link/LV3PR11MB876881B77D32A2854AD2908EF563A@LV3PR11MB8768.namprd11.prod.outlook.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 0506158 commit 15176b8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,11 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *proc
467467
break;
468468
}
469469
ret = sysfs_create_group(&pdev->dev.kobj, &dlvr_attribute_group);
470-
if (ret)
470+
if (ret) {
471+
if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_FIVR)
472+
sysfs_remove_group(&pdev->dev.kobj, &fivr_attribute_group);
471473
return ret;
474+
}
472475
}
473476

474477
if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_DVFS) {

0 commit comments

Comments
 (0)