* [PATCH]I2C device - release cleanup
@ 2010-03-23 10:01 Jean-Michel Hautbois
2010-03-23 12:54 ` Jean Delvare
0 siblings, 1 reply; 4+ messages in thread
From: Jean-Michel Hautbois @ 2010-03-23 10:01 UTC (permalink / raw)
To: Jean Delvare (PC drivers, core), Ben Dooks (embedded platforms)
Cc: linux-i2c, linux-kernel, Jean-Michel Hautbois
Hi there,
Here is a little patch which aims to cleanup the release function in i2c-dev.c.
This is only a call to single_release, instead of kfree and several things.
Signed-off-by: Jean-Michel Hautbois <jhautbois@gmail.com>
---
drivers/i2c/i2c-dev.c
--- linux-2.6.34-rc2/drivers/i2c/i2c-dev.c.orig 2010-03-23
10:19:26.000000000 +0100
+++ linux-2.6.34-rc2/drivers/i2c/i2c-dev.c 2010-03-23 10:55:54.000000000 +0100
@@ -36,6 +36,7 @@
#include <linux/i2c-dev.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h>
+#include <linux/seq_file.h>
static struct i2c_driver i2cdev_driver;
@@ -477,12 +478,10 @@ static int i2cdev_open(struct inode *ino
static int i2cdev_release(struct inode *inode, struct file *file)
{
struct i2c_client *client = file->private_data;
-
+
i2c_put_adapter(client->adapter);
- kfree(client);
- file->private_data = NULL;
-
- return 0;
+
+ return single_release(inode, file);
}
static const struct file_operations i2cdev_fops = {
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH]I2C device - release cleanup
2010-03-23 10:01 [PATCH]I2C device - release cleanup Jean-Michel Hautbois
@ 2010-03-23 12:54 ` Jean Delvare
[not found] ` <0016e6d64c23d0770e0482776d51@google.com>
0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2010-03-23 12:54 UTC (permalink / raw)
To: Jean-Michel Hautbois; +Cc: Ben Dooks, linux-i2c, linux-kernel
Hi Jean-Michel,
On Tue, 23 Mar 2010 11:01:28 +0100, Jean-Michel Hautbois wrote:
> Hi there,
>
> Here is a little patch which aims to cleanup the release function in i2c-dev.c.
> This is only a call to single_release, instead of kfree and several things.
>
> Signed-off-by: Jean-Michel Hautbois <jhautbois@gmail.com>
> ---
> drivers/i2c/i2c-dev.c
>
> --- linux-2.6.34-rc2/drivers/i2c/i2c-dev.c.orig 2010-03-23
> 10:19:26.000000000 +0100
> +++ linux-2.6.34-rc2/drivers/i2c/i2c-dev.c 2010-03-23 10:55:54.000000000 +0100
> @@ -36,6 +36,7 @@
> #include <linux/i2c-dev.h>
> #include <linux/jiffies.h>
> #include <asm/uaccess.h>
> +#include <linux/seq_file.h>
>
> static struct i2c_driver i2cdev_driver;
>
> @@ -477,12 +478,10 @@ static int i2cdev_open(struct inode *ino
> static int i2cdev_release(struct inode *inode, struct file *file)
> {
> struct i2c_client *client = file->private_data;
> -
> +
This is adding trailing white-space. Obviously you did not review your
own patch before sending it. And you did not run it through
scripts/checkpatch.pl either.
> i2c_put_adapter(client->adapter);
> - kfree(client);
> - file->private_data = NULL;
> -
> - return 0;
> +
> + return single_release(inode, file);
> }
>
> static const struct file_operations i2cdev_fops = {
Did you test your patch? I am very skeptical that calling
single_release() out of the blue is the right thing to do. My instinct
tells me that single_release() is only meant for callers of
single_open().
--
Jean Delvare
http://khali.linux-fr.org/wishlist.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-24 13:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-23 10:01 [PATCH]I2C device - release cleanup Jean-Michel Hautbois
2010-03-23 12:54 ` Jean Delvare
[not found] ` <0016e6d64c23d0770e0482776d51@google.com>
2010-03-23 16:21 ` Jean Delvare
[not found] ` <0016e6d977228ec35704827c94c6@google.com>
2010-03-24 13:16 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®