All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure
@ 2025-12-15  5:45 Kaushlendra Kumar
  2026-02-11  8:23 ` [RESEND, Cc only] " Kumar, Kaushlendra
  0 siblings, 1 reply; 4+ messages in thread
From: Kaushlendra Kumar @ 2025-12-15  5:45 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, lukasz.luba
  Cc: linux-pm, Kaushlendra Kumar

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>
---
 .../thermal/intel/int340x_thermal/processor_thermal_rfim.c   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
index 589a3a71f0c4..ba88d878c998 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
@@ -466,8 +466,11 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *proc
 			break;
 		}
 		ret = sysfs_create_group(&pdev->dev.kobj, &dlvr_attribute_group);
-		if (ret)
+		if (ret) {
+			if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_FIVR)
+				sysfs_remove_group(&pdev->dev.kobj, &fivr_attribute_group);
 			return ret;
+		}
 	}
 
 	if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_DVFS) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-11 19:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15  5:45 [PATCH] thermal: int340x: Fix sysfs group leak on DLVR registration failure Kaushlendra Kumar
2026-02-11  8:23 ` [RESEND, Cc only] " Kumar, Kaushlendra
2026-02-11 19:31   ` srinivas pandruvada
2026-02-11 19:57     ` Rafael J. Wysocki

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.