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: <20130820113503.GC23007@mudshark.cambridge.arm.com>
Date:	Tue, 20 Aug 2013 12:35:03 +0100
From:	Will Deacon <will.deacon@....com>
To:	Julia Lawall <Julia.Lawall@...6.fr>
Cc:	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/7] iommu/arm: replace devm_request_and_ioremap by
 devm_ioremap_resource

Hi Julia,

On Mon, Aug 19, 2013 at 12:20:37PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@...6.fr>
> 
> Use devm_ioremap_resource instead of devm_request_and_ioremap.
> 
> This was partly done using the semantic patch
> scripts/coccinelle/api/devm_ioremap_resource.cocci
> 
> The error-handling code on the call to platform_get_resource was removed
> manually, and the initialization of smmu->size was manually moved lower, to
> take advantage of the NULL test on res performed by devm_ioremap_resource.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>
> 
> ---
>  drivers/iommu/arm-smmu.c |   11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index ebd0a4c..dd91465 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1761,15 +1761,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>  	smmu->dev = dev;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(dev, "missing base address/size\n");
> -		return -ENODEV;
> -	}
> -
> +	smmu->base = devm_ioremap_resource(dev, res);
> +	if (IS_ERR(smmu->base))
> +		return PTR_ERR(smmu->base);
>  	smmu->size = resource_size(res);
> -	smmu->base = devm_request_and_ioremap(dev, res);
> -	if (!smmu->base)
> -		return -EADDRNOTAVAIL;

This does mean we trade arguably more useful error codes for the catch-all
-EINVAL, but the code ends up looking neater so I can be swayed either way.

Is this part of a series you're dealing with, or would you like me to take
this (I already sent my SMMU patches for 3.12)?

Cheers,

Will
--
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