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]
Message-ID: <20200825112517.GP2639@vkoul-mobl>
Date:   Tue, 25 Aug 2020 16:55:17 +0530
From:   Vinod Koul <vkoul@...nel.org>
To:     Alexandru Ardelean <alexandru.ardelean@...log.com>
Cc:     dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
        lars@...afoo.de, dan.j.williams@...el.com, ardeleanalex@...il.com
Subject: Re: [PATCH 3/5] dmaengine: axi-dmac: wrap entire dt parse in a
 function

On 19-08-20, 10:16, Alexandru Ardelean wrote:
> All these attributes will be read from registers in newer core versions, so
> just wrap the logic into a function.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> ---
>  drivers/dma/dma-axi-dmac.c | 39 ++++++++++++++++++++++++--------------
>  1 file changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> index 07665c60c21b..473c4a159c89 100644
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
> @@ -774,6 +774,28 @@ static int axi_dmac_parse_chan_dt(struct device_node *of_chan,
>  	return 0;
>  }
>  
> +static int axi_dmac_parse_dt(struct device *dev, struct axi_dmac *dmac)
> +{
> +	struct device_node *of_channels, *of_chan;
> +	int ret;
> +
> +	of_channels = of_get_child_by_name(dev->of_node, "adi,channels");
> +	if (of_channels == NULL)
> +		return -ENODEV;
> +
> +	for_each_child_of_node(of_channels, of_chan) {
> +		ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan);
> +		if (ret) {
> +			of_node_put(of_chan);
> +			of_node_put(of_channels);
> +			return -EINVAL;
> +		}
> +	}
> +	of_node_put(of_channels);
> +
> +	return 0;
> +}
> +
>  static int axi_dmac_detect_caps(struct axi_dmac *dmac, unsigned int version)
>  {
>  	struct axi_dmac_chan *chan = &dmac->chan;
> @@ -823,7 +845,6 @@ static int axi_dmac_detect_caps(struct axi_dmac *dmac, unsigned int version)
>  
>  static int axi_dmac_probe(struct platform_device *pdev)
>  {
> -	struct device_node *of_channels, *of_chan;
>  	struct dma_device *dma_dev;
>  	struct axi_dmac *dmac;
>  	struct resource *res;
> @@ -856,19 +877,9 @@ static int axi_dmac_probe(struct platform_device *pdev)
>  
>  	INIT_LIST_HEAD(&dmac->chan.active_descs);
>  
> -	of_channels = of_get_child_by_name(pdev->dev.of_node, "adi,channels");
> -	if (of_channels == NULL)
> -		return -ENODEV;
> -
> -	for_each_child_of_node(of_channels, of_chan) {
> -		ret = axi_dmac_parse_chan_dt(of_chan, &dmac->chan);
> -		if (ret) {
> -			of_node_put(of_chan);
> -			of_node_put(of_channels);
> -			return -EINVAL;
> -		}
> -	}
> -	of_node_put(of_channels);
> +	ret = axi_dmac_parse_dt(&pdev->dev, dmac);
> +	if (ret < 0)

this need to jump to err_clk_disable

> +		return ret;
>  
>  	pdev->dev.dma_parms = &dmac->dma_parms;
>  	dma_set_max_seg_size(&pdev->dev, UINT_MAX);
> -- 
> 2.17.1

-- 
~Vinod

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ