[PATCH 1/3] platform: add common resource requesting and mapping helper
Wolfram Sang
w.sang at pengutronix.de
Tue Jan 31 05:17:34 EST 2012
On Tue, Jan 31, 2012 at 06:00:00PM +0800, Barry Song wrote:
> From: Barry Song <Baohua.Song at csr.com>
>
> this patch helps to move the common pattern from
>
> "
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!res) {
> ret = -ENODEV;
> goto err;
> }
You don't need to do the error checking for 'res'. You can simply do
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_request_and_ioremap(&dev->dev, res);
devm_request_and_ioremap() will check res. Given that, I don't think
we can save a lot with another wrapper.
Thanks,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120131/dce0275d/attachment.sig>
More information about the linux-mtd
mailing list