Re: [PATCH v9 8/10] x86, mm: Add set_memory_wt() for WT

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

 



On Fri, 2015-05-22 at 09:48 +0200, Thomas Gleixner wrote:
> On Wed, 13 May 2015, Toshi Kani wrote:
> > +int set_memory_wt(unsigned long addr, int numpages)
> > +{
> > +	int ret;
> > +
> > +	if (!pat_enabled)
> > +		return set_memory_uc(addr, numpages);
> > +
> > +	ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
> > +			      _PAGE_CACHE_MODE_WT, NULL);
> > +	if (ret)
> > +		goto out_err;
> > +
> > +	ret = _set_memory_wt(addr, numpages);
> > +	if (ret)
> > +		goto out_free;
> > +
> > +	return 0;
> > +
> > +out_free:
> > +	free_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE);
> > +out_err:
> > +	return ret;
> 
> 
> This goto zoo is horrible to read. What's wrong with a straight forward:
> 
> +	if (!pat_enabled)
> +		return set_memory_uc(addr, numpages);
> +
> +	ret = reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
> +			      _PAGE_CACHE_MODE_WT, NULL);
> +	if (ret)
> +		return ret;
> +
> +	ret = _set_memory_wt(addr, numpages);
> +	if (ret)
> +		free_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE);
> +	return ret;

Agreed.  I will change set_memory_wc() as well, which is the base of
this function. 

Thanks,
-Toshi


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]