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] [day] [month] [year] [list]
Message-ID: <5315AFFA.40101@ti.com>
Date:	Tue, 4 Mar 2014 12:50:34 +0200
From:	Peter Ujfalusi <peter.ujfalusi@...com>
To:	Alexander Shiyan <shc_work@...l.ru>
CC:	Santosh Shilimkar <santosh.shilimkar@...com>,
	Tony Lindgren <tony@...mide.com>,
	Olof Johansson <olof@...om.net>, <linux-omap@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, Arnd Bergmann <arnd@...db.de>,
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 2/5] drivers: bus: omap_l3: Convert to use devm_request_and_ioremap()

On 03/04/2014 11:12 AM, Alexander Shiyan wrote:
> Вторник,  4 марта 2014, 11:01 +02:00 от Peter Ujfalusi <peter.ujfalusi@...com>:
>> We can then remove the iounmap() calls from probe and remove.
>> Since the driver requests the resources via index we can do the mem resource
>> request within a for loop.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@...com>
>> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti>
>> ---
> 
>> +	/* Get mem resources */
>> +	for (i = 0; i < 3; i++) {
>> +		struct resource	*res = platform_get_resource(pdev,
>> +							     IORESOURCE_MEM, i);
>> +		if (!res) {
>> +			dev_err(&pdev->dev, "couldn't find resource %d\n", i);
>> +			return -ENODEV;
>> +		}
> 
> No need to check "res". devm_request_and_ioremap() do all for us.
> 
>> -	l3->l3_base[2] = ioremap(res->start, resource_size(res));
>> -	if (!l3->l3_base[2]) {
>> -		dev_err(&pdev->dev, "ioremap failed\n");
>> -		ret = -ENOMEM;
>> -		goto err2;
>> +		l3->l3_base[i] = devm_request_and_ioremap(&pdev->dev, res);
>> +		if (!l3->l3_base[i]) {
> 
> if (IS_ERR(l3->l3_base[i]))
> 
>> +			dev_err(&pdev->dev, "ioremap %d failed\n", i);
> 
> Unnecessary.

I'm going to keep this since it tells which resource of the three has failed.

> 
>> +			return -ENOMEM;
> 
> return PTR_ERR(l3->l3_base[i]);
> 
> ---
> 


-- 
Péter
--
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