lkml.org 
[lkml]   [2013]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH RFC v3 1/3] i2c: i2c-bfin-twi: convert to devm_* API
Date
Hi Libo,

>-----Original Message-----
>From: Libo Chen [mailto:libo.chen@huawei.com]
>Sent: Thursday, May 23, 2013 8:00 PM
>To: wsa@the-dreams.de
>Cc: guz.fnst@cn.fujitsu.com; Zhang, Sonic; uclinux-dist-
>devel@blackfin.uclinux.org; linux-i2c@vger.kernel.org; linux-
>kernel@vger.kernel.org; lizefan@huawei.com; libo.chen@huawei.com
>Subject: [PATCH RFC v3 1/3] i2c: i2c-bfin-twi: convert to devm_* API
>
>peripheral_request_list has got free if any one faild, so no need to free again in err
>case.
>aovid this, convert them to devm_* API
>
>Signed-off-by: Libo Chen <libo.chen@huawei.com>
>---
> drivers/i2c/busses/i2c-bfin-twi.c | 38 +++++++++---------------------------
> 1 files changed, 10 insertions(+), 28 deletions(-)
>
>diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
>index 05080c4..2b99c48 100644
>--- a/drivers/i2c/busses/i2c-bfin-twi.c
>+++ b/drivers/i2c/busses/i2c-bfin-twi.c
>@@ -621,35 +621,27 @@ static int i2c_bfin_twi_probe(struct platform_device
>*pdev)
> int rc;
> unsigned int clkhilow;
>
>- 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



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