On Tue, Nov 5, 2013 at 1:22 AM, Yann Droneaud <ydroneaud@xxxxxxxxxx> wrote: > Calling anon_inode_getfile() with get_unused_fd() and fd_install() > can be replaced by a single call to anon_inode_getfd(). > > Signed-off-by: Yann Droneaud <ydroneaud@xxxxxxxxxx> > --- > interpreter/ktap.c | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) > > diff --git a/interpreter/ktap.c b/interpreter/ktap.c > index 18d8fc8..c7b154c 100644 > --- a/interpreter/ktap.c > +++ b/interpreter/ktap.c > @@ -167,22 +167,13 @@ static const struct file_operations ktap_fops = { > > static long ktapvm_ioctl(struct file *file, unsigned int cmd, unsigned long > arg) > { > - int new_fd, err; > - struct file *new_file; > + int new_fd; > > - new_fd = get_unused_fd(); > - if (new_fd < 0) > + new_fd = anon_inode_getfd("[ktap]", &ktap_fops, NULL, O_RDWR); > + if (new_fd < 0) { > return new_fd; A small coding style issue: after you patch you didn't need brackets here Other than that, looks good. > - > - new_file = anon_inode_getfile("[ktap]", &ktap_fops, NULL, O_RDWR); > - if (IS_ERR(new_file)) { > - err = PTR_ERR(new_file); > - put_unused_fd(new_fd); > - return err; > } > > - file->private_data = NULL; > - fd_install(new_fd, new_file); > return new_fd; > } > > -- > 1.8.3.1 > > -- Respectfully Azat Khuzhin