Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1351577

Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL

From "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL
Date 2016-03-07 13:30 +0100
Message-ID <ra2sr-2NF-37@gated-at.bofh.it> (permalink)
References <r9ZEe-Y3-13@gated-at.bofh.it> <ra1PH-2jh-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 2016/3/7 19:41, One Thousand Gnomes wrote:
> On Mon, 7 Mar 2016 17:21:25 +0800
> Zhen Lei <thunder.leizhen@huawei.com> wrote:
> 
>> Do this to keep consistent with kfree, which tolerate ptr is NULL.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> 
> This is inlined code so you are adding extra logic to every single
> instance of a call to the function. What is it's total effect on kernel
> size ?

This a simple if statement, I think it will only generates two instructions.
Maybe I need move it into function dma_free_attrs, as below:
if (!ops->free || !cpu_addr)
	return;

So that, it only generates one instruction. And dma_free_noncoherent can also be impacted.

Or I changed it to BUG_ON(!cpu_addr)?

Otherwise, I move it into ops->free, but that maybe more ARCHs.

> 
> Alan
> 
> .
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL Zhen Lei <thunder.leizhen@huawei.com> - 2016-03-07 10:30 +0100
  Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> - 2016-03-07 11:50 +0100
    Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is  NULL Andrew Morton <akpm@linux-foundation.org> - 2016-03-08 00:00 +0100
      Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> - 2016-03-08 02:40 +0100
  Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is  NULL One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-03-07 12:50 +0100
    Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com> - 2016-03-07 13:30 +0100

csiph-web