Re: [Regression, post-2.6.34-rc1][PATCH] x86 / perf: Fix suspend to RAM on HP nx6325

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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
_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux