[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e8ac1af10612130521i2bc2032fl81c82b7c513b69c4@mail.gmail.com>
Date: Wed, 13 Dec 2006 18:51:47 +0530
From: "Tushar Adeshara" <adesharatushar@...il.com>
To: "Evgeniy Polyakov" <johnpol@....mipt.ru>,
linux-kernel@...r.kernel.org
Subject: Re: Kevent POSIX timers support.
On 11/23/06, Evgeniy Polyakov <johnpol@....mipt.ru> wrote:
> On Wed, Nov 22, 2006 at 01:44:16PM +0300, Evgeniy Polyakov (johnpol@....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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists