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]
Message-ID: <YL3l1upzyU83+iL/@infradead.org>
Date:   Mon, 7 Jun 2021 10:24:38 +0100
From:   Christoph Hellwig <hch@...radead.org>
To:     Sven Peter <sven@...npeter.dev>
Cc:     linux-usb@...r.kernel.org, Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] usb: dwc3: support 64 bit DMA in platform driver

On Sun, Jun 06, 2021 at 11:36:29AM +0200, Sven Peter wrote:
> +	/* Try to set 64-bit DMA first */
> +	if (WARN_ON(!dwc->sysdev->dma_mask))
> +		/* Platform did not initialize dma_mask */
> +		ret = dma_coerce_mask_and_coherent(dwc->sysdev,
> +						   DMA_BIT_MASK(64));
> +	else
> +		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));

WARN_ON + fallback seems weird.  I'd suggest to just error out for the
warn case.

> +	/* If seting 64-bit DMA mask fails, fall back to 32-bit DMA mask */
> +	if (ret) {
> +		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(32));
> +		if (ret)
> +			return ret;
> +	}

Setting a 64-bit mask will not fail.  No need for the fallback.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ