Re: Kevent POSIX timers support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/23/06, Evgeniy Polyakov <[email protected]> wrote:
On Wed, Nov 22, 2006 at 01:44:16PM +0300, Evgeniy Polyakov ([email protected]) wrote:
+static int posix_kevent_init_timer(struct k_itimer *tmr, int fd)
+{
+       struct ukevent uk;
+       struct file *file;
+       struct kevent_user *u;
+       int err;
+
+       file = fget(fd);
+       if (!file) {
+               err = -EBADF;
+               goto err_out;
+       }
+
+       if (file->f_op != &kevent_user_fops) {
+               err = -EINVAL;
+               goto err_out_fput;
+       }
+
+       u = file->private_data;
+
+       memset(&uk, 0, sizeof(struct ukevent));
+
+       uk.type = KEVENT_POSIX_TIMER;
+       uk.id.raw_u64 = (unsigned long)(tmr); /* Just cast to something unique */
+       uk.ptr = tmr;
+
+       tmr->it_sigev_value.sival_ptr = file;
+
+       err = kevent_user_add_ukevent(&uk, u);

I think these four lines are not required. Irrespective of return
value of kevent_user_add_ukevent(), we are going to release file, and
return err.

+       if (err)
+               goto err_out_fput;
+
+       fput(file);
+
+       return 0;


+
+err_out_fput:
+       fput(file);
+err_out:
+       return err;
+}
+

--
Regards,
Tushar
--------------------
It's not a problem, it's an opportunity for improvement. Lets improve.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux