lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 28 Jun 2017 15:41:38 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Christoph Hellwig <hch@....de>, linux-kernel@...r.kernel.org,
        m.szyprowski@...sung.com
Subject: Re: [PATCH 2/2] dma-coherent: remove the DMA_MEMORY_MAP and
 DMA_MEMORY_IO flags

On 27/06/17 21:17, Christoph Hellwig wrote:
> DMA_MEMORY_IO was never used in the tree, so remove it.  That means there is
> no need for the DMA_MEMORY_MAP flag either now, so remove it as well and
> change dma_declare_coherent_memory to return a normal errno value.
> 
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---

[...]

> diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
> index 10e7c022e8cf..b96bfffd314e 100644
> --- a/drivers/base/dma-mapping.c
> +++ b/drivers/base/dma-mapping.c
> @@ -176,13 +176,10 @@ int dmam_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
>  
>  	rc = dma_declare_coherent_memory(dev, phys_addr, device_addr, size,
>  					 flags);
> -	if (rc) {
> +	if (rc)

if (!rc)

>  		devres_add(dev, res);
> -		rc = 0;
> -	} else {
> +	else
>  		devres_free(res);
> -		rc = -ENOMEM;
> -	}
>  
>  	return rc;
>  }

[...]

> diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
> index a8b8d8b8d9f3..21302a0f82e2 100644
> --- a/drivers/usb/host/ohci-sm501.c
> +++ b/drivers/usb/host/ohci-sm501.c
> @@ -123,11 +123,11 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
>  	 * regular memory. The HCD_LOCAL_MEM flag does just that.
>  	 */
>  
> -	if (!dma_declare_coherent_memory(dev, mem->start,
> +	retval = dma_declare_coherent_memory(dev, mem->start,
>  					 mem->start - mem->parent->start,
>  					 resource_size(mem),
> -					 DMA_MEMORY_MAP |
> -					 DMA_MEMORY_EXCLUSIVE)) {
> +					 DMA_MEMORY_EXCLUSIVE);
> +	if (retval) {
>  		dev_err(dev, "cannot declare coherent memory\n");
>  		retval = -ENXIO;

It looks like we could just let retval propagate here, rather than
rewriting it, since we're only bailing out of a probe routine.

Robin.

>  		goto err1;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ