lkml.org 
[lkml]   [2006]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Kevent POSIX timers support.
On 11/23/06, Evgeniy Polyakov <johnpol@2ka.mipt.ru> wrote:
> On Wed, Nov 22, 2006 at 01:44:16PM +0300, Evgeniy Polyakov (johnpol@2ka.mipt.ru) 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-13 14:25    [W:0.086 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site