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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <00a33e10-b563-a7e1-4180-10386f803b75@samsung.com>
Date:   Tue, 20 Aug 2019 15:45:19 +0200
From:   Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:     "Enrico Weigelt, metux IT consult" <info@...ux.net>
Cc:     linux-kernel@...r.kernel.org, axboe@...nel.dk, hdegoede@...hat.com,
        linus.walleij@...aro.org, linux-ide@...r.kernel.org,
        linux-tegra@...r.kernel.org
Subject: Re: [PATCH 4/9] drivers: ata: ahci_xgene: use
 devm_platform_ioremap_resource()


On 8/20/19 2:35 PM, Enrico Weigelt, metux IT consult wrote:
> Use the new helper that wraps the calls to platform_get_resource()
> and devm_ioremap_resource() together.
> 
> Signed-off-by: Enrico Weigelt, metux IT consult <info@...ux.net>
> ---
>  drivers/ata/ahci_xgene.c | 21 +++++++--------------
>  1 file changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
> index 16246c8..5391f5d 100644
> --- a/drivers/ata/ahci_xgene.c
> +++ b/drivers/ata/ahci_xgene.c
> @@ -739,7 +739,6 @@ static int xgene_ahci_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct ahci_host_priv *hpriv;
>  	struct xgene_ahci_context *ctx;
> -	struct resource *res;
>  	const struct of_device_id *of_devid;
>  	enum xgene_ahci_version version = XGENE_AHCI_V1;
>  	const struct ata_port_info *ppi[] = { &xgene_ahci_v1_port_info,
> @@ -759,31 +758,25 @@ static int xgene_ahci_probe(struct platform_device *pdev)
>  	ctx->dev = dev;
>  
>  	/* Retrieve the IP core resource */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	ctx->csr_core = devm_ioremap_resource(dev, res);
> +	ctx->csr_core = devm_platform_ioremap_resource(pdev, 1);
>  	if (IS_ERR(ctx->csr_core))
>  		return PTR_ERR(ctx->csr_core);
>  
>  	/* Retrieve the IP diagnostic resource */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> -	ctx->csr_diag = devm_ioremap_resource(dev, res);
> +	ctx->csr_diag = devm_platform_ioremap_resource(pdev, 2);
>  	if (IS_ERR(ctx->csr_diag))
>  		return PTR_ERR(ctx->csr_diag);
>  
>  	/* Retrieve the IP AXI resource */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
> -	ctx->csr_axi = devm_ioremap_resource(dev, res);
> +	ctx->csr_axi = devm_platform_ioremap_resource(pdev, 3);
>  	if (IS_ERR(ctx->csr_axi))
>  		return PTR_ERR(ctx->csr_axi);
>  
>  	/* Retrieve the optional IP mux resource */
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 4);
> -	if (res) {
> -		void __iomem *csr = devm_ioremap_resource(dev, res);
> -		if (IS_ERR(csr))
> -			return PTR_ERR(csr);
> -
> -		ctx->csr_mux = csr;
> +	ctx->csr_mux = csr = devm_platform_ioremap_resource(pdev, 4);

This conversion is incorrect - despite the resource being optional
we will get error message from devm_[platform_]ioremap_resource()
(it always prints an error on !res condition).

> +	if (IS_ERR(ctx->csr_mux)) {
> +		dev_info(&pdev->dev, "cant get ip mux resource (optional)");

No need for this message.

> +		ctx->csr_mux = NULL;
>  	}
>  
>  	of_devid = of_match_device(xgene_ahci_of_match, dev);

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ