[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1003211029480.18017@i5.linux-foundation.org>
Date: Sun, 21 Mar 2010 10:31:52 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Rafael J. Wysocki" <rjw@...k.pl>
cc: Peter Zijlstra <peterz@...radead.org>,
pm list <linux-pm@...ts.linux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [Regression, post-2.6.34-rc1][PATCH] x86 / perf: Fix suspend to
RAM on HP nx6325
On Sat, 20 Mar 2010, Rafael J. Wysocki wrote:
>
> The appended patch fixes the breakage for me too.
Please don't use a 'goto' for something like this.
> raw_spin_lock(&amd_nb_lock);
>
> + if (!cpuhw->amd_nb)
> + goto unlock;
> +
> if (--cpuhw->amd_nb->refcnt == 0)
> kfree(cpuhw->amd_nb);
>
> cpuhw->amd_nb = NULL;
>
> + unlock:
> raw_spin_unlock(&amd_nb_lock);
> }
Just do
raw_spin_lock(&amd_nb_lock);
if (cpuhw->amd_nb) {
if (!--cpuhw->amd_nb->refcnt)
kfree(cpuhw->amd_nb);
cpuhw->amd_nb = NULL;
}
raw_spin_unlock(&amd_nb_lock);
instead. Much more readable.
Let's keep 'goto' for cases where we have error returns that we don't want
to nest, not trivial stuff like this.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists