lkml.org 
[lkml]   [2013]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/16] mfd: 88pm860x: Convert to managed resources for allocating memory
Date
---
drivers/mfd/88pm860x-core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index 31ca555..ef6d82c 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -1150,7 +1150,8 @@ static int pm860x_probe(struct i2c_client *client,
return -EINVAL;
}

- chip = kzalloc(sizeof(struct pm860x_chip), GFP_KERNEL);
+ chip = devm_kzalloc(&client->dev,
+ sizeof(struct pm860x_chip), GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;

@@ -1160,7 +1161,6 @@ static int pm860x_probe(struct i2c_client *client,
ret = PTR_ERR(chip->regmap);
dev_err(&client->dev, "Failed to allocate register map: %d\n",
ret);
- kfree(chip);
return ret;
}
chip->client = client;
@@ -1204,7 +1204,6 @@ static int pm860x_remove(struct i2c_client *client)
i2c_unregister_device(chip->companion);
}
regmap_exit(chip->regmap);
- kfree(chip);
return 0;
}

--
1.7.10.4


\
 
 \ /
  Last update: 2013-05-23 18:21    [W:0.069 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site