From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Chou Date: Sat, 10 Oct 2015 13:33:06 +0800 Subject: [U-Boot] [PATCH v3] nios2: convert dma_alloc_coherent to use memalign In-Reply-To: <201510091649.28747.marex@denx.de> References: <1444013823-11909-1-git-send-email-thomas@wytron.com.tw> <1444390262-15804-1-git-send-email-thomas@wytron.com.tw> <201510091649.28747.marex@denx.de> Message-ID: <5618A312.1030306@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, On 10/09/2015 10:49 PM, Marek Vasut wrote: >> + *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len); > > This still modifies the handle in both cases (failure and success). > We really want to modify external variables in case of failure, no? The *handle return a DMA address, and the function itself return a virtual address. Both of them should be set to NULL in case of failure. It might be wrong to keep DMA address looks alive but actually dead. Best regards, Thomas Chou