Le lundi 12 mai 2014 à 12:32 +0200, Bart Van Assche a écrit :
> On 05/12/14 12:18, Yann Droneaud wrote:
> > Le lundi 12 mai 2014 à 10:30 +0200, Bart Van Assche a écrit :
> >> port = container_of(inode->i_cdev, struct ib_umad_port, cdev);
> >> kref_get(&port->umad_dev->ref);
> >>
> >> mutex_lock(&port->file_mutex);
> >>
> >> - if (!port->ib_dev) {
> >> - ret = -ENXIO;
> >> + if (!port->ib_dev)
> >> goto out;
> >> - }
> >>
> >> + ret = -ENOMEM;
> > especially here: I think it should be moved in the error handling path:
> >
> >> file = kzalloc(sizeof *file, GFP_KERNEL);
> >> - if (!file) {
> >> - kref_put(&port->umad_dev->ref, ib_umad_release_dev);
> >> - ret = -ENOMEM;
> > keep it here.
>
> Does this mean that you are not aware that setting the return code
> before an if-test is a common coding style in the Linux kernel ? See
> e.g. kernel/futex.c or kernel/events/core.c for other examples.
>
Perhaps, but it's nowhere else in user_mad.c
Regards.
--
Yann Droneaud
OPTEYA
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html