lkml.org 
[lkml]   [2013]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC v3 1/3] i2c: i2c-bfin-twi: convert to devm_* API
On 2013/5/24 10:49, Zhang, Sonic wrote:
>> >- iface = kzalloc(sizeof(struct bfin_twi_iface), GFP_KERNEL);
>> >+ iface = devm_kzalloc(&pdev->dev, sizeof(struct bfin_twi_iface),
>> >+ GFP_KERNEL);
>> > if (!iface) {
>> > dev_err(&pdev->dev, "Cannot allocate memory\n");
>> >- rc = -ENOMEM;
>> >- goto out_error_nomem;
>> >+ return -ENOMEM;
>> > }
>> >
>> > spin_lock_init(&(iface->lock));
>> >
>> > /* Find and map our resources */
>> > res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> >- if (res == NULL) {
>> >- dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n");
>> >- rc = -ENOENT;
>> >- goto out_error_get_res;
>> >- }
> Why remove the resource mem check?
>
> Regards,
>
> Sonic

devm_ioremap_resource() had done for us, you can refernce the function`comment.

Thanks,

Libo






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