lkml.org 
[lkml]   [2013]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 04/42] drivers/dma: don't check resource with devm_ioremap_resource
On 05/10/2013 11:57 AM, Wolfram Sang wrote:
> On Fri, May 10, 2013 at 10:35:32AM -0600, Stephen Warren wrote:
>> On 05/10/2013 02:16 AM, Wolfram Sang wrote:
>>> devm_ioremap_resource does sanity checks on the given resource. No need to
>>> duplicate this in the driver.
>>
>>> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
>>
>>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> - if (!res) {
>>> - dev_err(&pdev->dev, "No mem resource for DMA\n");
>>> - return -EINVAL;
>>> - }
>>> -
>>> tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
>>
>> One issue here is that it's not obvious just from reading the code
>> that's left behind that the "missing" error-checking of the
>> platform_get_resource() return value is OK because
>> devm_ioremap_resource() will check it "for us". Everyone now has to
>> mentally maintain a list of exceptions where it's OK not to error-check.
>
> My goal is to make not-checking the standard case with devm.

OK, if no parameters passed to any devm function every need to be
error-checked, that'll certainly be a bit easier to remember.


\
 
 \ /
  Last update: 2013-05-10 22:01    [W:0.086 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site