linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linuxppc-dev@lists.ozlabs.org
Subject: [Bug 206695] kmemleak reports leaks in drivers/macintosh/windfarm
Date: Fri, 06 Mar 2020 00:01:17 +0000	[thread overview]
Message-ID: <bug-206695-206035-sj3epKGbHo@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-206695-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=206695

--- Comment #5 from mpe@ellerman.id.au ---
bugzilla-daemon@bugzilla.kernel.org writes:
> https://bugzilla.kernel.org/show_bug.cgi?id=206695
>
> --- Comment #4 from Erhard F. (erhard_f@mailbox.org) ---
> (In reply to mpe from comment #3)
>> Can you try this patch?
>
> Applied your patch on top of 5.6-rc4 +
> https://patchwork.ozlabs.org/patch/1248350/ and let the G5 do a few hours
> compiling.
>
> Only getting those nice memleaks from bug #206203 but no windfarm_pm112
> memleak
> any longer. So your patch works well it seems. Thanks!

Thanks.

Can you try this one instead, it changes the order of operations to make
the code flow a bit nicer.

cheers

diff --git a/drivers/macintosh/windfarm_pm112.c
b/drivers/macintosh/windfarm_pm112.c
index 4150301a89a5..e8377ce0a95a 100644
--- a/drivers/macintosh/windfarm_pm112.c
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -132,14 +132,6 @@ static int create_cpu_loop(int cpu)
        s32 tmax;
        int fmin;

-       /* Get PID params from the appropriate SAT */
-       hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL);
-       if (hdr == NULL) {
-               printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n");
-               return -EINVAL;
-       }
-       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) {
@@ -152,6 +144,16 @@ static int create_cpu_loop(int cpu)
        if (tmax < cpu_all_tmax)
                cpu_all_tmax = tmax;

+       kfree(hdr);
+
+       /* Get PID params from the appropriate SAT */
+       hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL);
+       if (hdr == NULL) {
+               printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n");
+               return -EINVAL;
+       }
+       piddata = (struct smu_sdbp_cpupiddata *)&hdr[1];
+
        /*
         * Darwin has a minimum fan speed of 1000 rpm for the 4-way and
         * 515 for the 2-way.  That appears to be overkill, so for now,
@@ -174,6 +176,9 @@ static int create_cpu_loop(int cpu)
                pid.min = fmin;

        wf_cpu_pid_init(&cpu_pid[cpu], &pid);
+
+       kfree(hdr);
+
        return 0;
 }

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

  parent reply	other threads:[~2020-03-06  0:04 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 ` [Bug 206695] New: " Michael Ellerman
2020-03-05 12:22 ` [Bug 206695] " bugzilla-daemon
2020-03-05 22:09 ` bugzilla-daemon
2020-03-06  0:01   ` Michael Ellerman
2020-03-06  0:01 ` bugzilla-daemon [this message]
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=bug-206695-206035-sj3epKGbHo@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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).