linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
To: lukasz.luba@arm.com, rafael@kernel.org, pavel@kernel.org
Cc: linux-pm@vger.kernel.org,
	Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Subject: [PATCH] PM: energy_model: Replace kfree() with em_table_free()
Date: Mon, 13 Oct 2025 14:46:21 +0530	[thread overview]
Message-ID: <20251013091621.1191919-1-kaushlendra.kumar@intel.com> (raw)

Replace kfree() with em_table_free() for error path of em_create_pd()
to ensure proper cleanup of energy model tables. The em_table_free()
function provides the correct deallocation mechanism for energy model
table structures, ensuring consistent memory management throughout the
energy model subsystem.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
 kernel/power/energy_model.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 5f17d2e8e954..e8ae1f518b8a 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -441,7 +441,7 @@ static int em_create_pd(struct device *dev, int nr_states,
 	return 0;
 
 free_pd_table:
-	kfree(em_table);
+	em_table_free(em_table);
 free_pd:
 	kfree(pd);
 	return -EINVAL;
-- 
2.34.1


             reply	other threads:[~2025-10-13  9:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13  9:16 Kaushlendra Kumar [this message]
2025-10-14 11:01 ` [PATCH] PM: energy_model: Replace kfree() with em_table_free() Christian Loehle
2025-10-14 12:43   ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251013091621.1191919-1-kaushlendra.kumar@intel.com \
    --to=kaushlendra.kumar@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).