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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 02 Aug 2013 13:59:59 -0600
From:	Stephen Warren <swarren@...dotorg.org>
To:	Richard Zhao <rizhao@...dia.com>
CC:	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	vinod.koul@...el.com, djbw@...com, grant.likely@...aro.org,
	rob.herring@...xeda.com
Subject: Re: [PATCH] DMA: add help function to check whether dma controller
 registered

On 08/02/2013 12:04 AM, Richard Zhao wrote:
> DMA client device driver usually needs to know at probe time whether
> dma controller has been registered to deffer probe. So add a help
> function of_dma_check_controller.
> 
> DMA request channel functions can also used to check it, but they
> are usually called at open() time.

> diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
> index e1c4d3b..b6828c1 100644

> +int of_dma_check_controller(struct device *dev, const char *name)


> +	for (i = 0; i < count; i++) {
> +		if (of_dma_match_channel(np, name, i, &dma_spec))
> +			continue;
> +
> +		mutex_lock(&of_dma_lock);
> +		ofdma = of_dma_find_controller(&dma_spec);
> +		mutex_unlock(&of_dma_lock);
> +		of_node_put(dma_spec.np);

Do we need to add the following here:

if (ofdma)
	break

To ensure that as soon as a successful match is found, the loop exits?
Otherwise, if there are multiple providers for that name, and the first
N are registered but the last isn't, this function will still return
failure.

> +	if (ofdma)
> +		return 0;
> +	else
> +		return -ENODEV;

That probably should be -EPROBE_DEFER?

Although, what about differentiating between "entry not found by
of_dma_match_channel" and "controller not yet probed"?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ