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: <20230712140953.30b5309c@xps-13>
Date:   Wed, 12 Jul 2023 14:09:53 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Yangtao Li <frank.li@...o.com>
Cc:     Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to
 devm_platform_ioremap_resource()

Hi Yangtao,

frank.li@...o.com wrote on Fri,  7 Jul 2023 12:06:13 +0800:

> Use devm_platform_ioremap_resource() to simplify code.
> 
> Signed-off-by: Yangtao Li <frank.li@...o.com>
> ---
>  drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
> index 415d6aaa8255..2db1cd1d3d03 100644
> --- a/drivers/mtd/nand/raw/davinci_nand.c
> +++ b/drivers/mtd/nand/raw/davinci_nand.c
> @@ -710,8 +710,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  {
>  	struct davinci_nand_pdata	*pdata;
>  	struct davinci_nand_info	*info;
> -	struct resource			*res1;
> -	struct resource			*res2;
> +	struct resource			*res;
>  	void __iomem			*vaddr;
>  	void __iomem			*base;
>  	int				ret;
> @@ -736,26 +735,24 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, info);
>  
> -	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	if (!res1 || !res2) {
> -		dev_err(&pdev->dev, "resource missing\n");
> -		return -EINVAL;
> -	}
> -
> -	vaddr = devm_ioremap_resource(&pdev->dev, res1);
> +	vaddr = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(vaddr))
>  		return PTR_ERR(vaddr);
>  
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +	if (!res) {
> +		dev_err(&pdev->dev, "resource missing\n");
> +		return -EINVAL;
> +	}
>  	/*
>  	 * This registers range is used to setup NAND settings. In case with
>  	 * TI AEMIF driver, the same memory address range is requested already
>  	 * by AEMIF, so we cannot request it twice, just ioremap.
>  	 * The AEMIF and NAND drivers not use the same registers in this range.
>  	 */
> -	base = devm_ioremap(&pdev->dev, res2->start, resource_size(res2));
> +	base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
>  	if (!base) {
> -		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2);
> +		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res);

I believe this is the only use of the resource, I am in favor of just
using the regular devm_platform_ioremap_resource() helper here and just
drop the reference to the resource from the message.

I will apply all other patches, please send a v2 only for this one
once improved.

>  		return -EADDRNOTAVAIL;
>  	}
>  


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ