public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: bugzilla-daemon@bugzilla•kernel.org, linuxppc-dev@lists•ozlabs.org
Subject: Re: [Bug 206695] New: kmemleak reports leaks in drivers/macintosh/windfarm
Date: Thu, 05 Mar 2020 23:22:41 +1100	[thread overview]
Message-ID: <87sginousu.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <bug-206695-206035@https.bugzilla.kernel.org/>

Can you try this patch?

diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c
index 4150301a89a5..a16f43a1def9 100644
--- a/drivers/macintosh/windfarm_pm112.c
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -125,7 +125,7 @@ static int create_cpu_loop(int cpu)
 {
 	int chip = cpu / 2;
 	int core = cpu & 1;
-	struct smu_sdbp_header *hdr;
+	struct smu_sdbp_header *hdr, *hdr2;
 	struct smu_sdbp_cpupiddata *piddata;
 	struct wf_cpu_pid_param pid;
 	struct wf_control *main_fan = cpu_fans[0];
@@ -141,9 +141,9 @@ static int create_cpu_loop(int cpu)
 	piddata = (struct smu_sdbp_cpupiddata *)&hdr[1];
 
 	/* Get FVT params to get Tmax; if not found, assume default */
-	hdr = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL);
-	if (hdr) {
-		struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr[1];
+	hdr2 = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL);
+	if (hdr2) {
+		struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr2[1];
 		tmax = fvt->maxtemp << 16;
 	} else
 		tmax = 95 << 16;	/* default to 95 degrees C */
@@ -174,6 +174,10 @@ static int create_cpu_loop(int cpu)
 		pid.min = fmin;
 
 	wf_cpu_pid_init(&cpu_pid[cpu], &pid);
+
+	kfree(hdr);
+	kfree(hdr2);
+
 	return 0;
 }
 

  parent reply	other threads:[~2020-03-05 12:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 23:44 [Bug 206695] New: kmemleak reports leaks in drivers/macintosh/windfarm bugzilla-daemon
2020-02-27 23:45 ` [Bug 206695] " bugzilla-daemon
2020-02-27 23:45 ` bugzilla-daemon
2020-03-05 12:22 ` Michael Ellerman [this message]
2020-03-05 12:22 ` bugzilla-daemon
2020-03-05 22:09 ` bugzilla-daemon
2020-03-06  0:01   ` Michael Ellerman
2020-03-06  0:01 ` bugzilla-daemon
2020-03-06  9:54 ` bugzilla-daemon
2020-04-23  6:53 ` bugzilla-daemon
2020-04-23  6:54 ` bugzilla-daemon
2020-04-24  0:30 ` bugzilla-daemon
2020-04-26 22:05 ` bugzilla-daemon

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=87sginousu.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=bugzilla-daemon@bugzilla$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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