Re: [PATCH] Add support for keyboard on SEGA Dreamcast

Dmitry Torokhov
2007-09-05T04:50:28Z

Hi Mike,

On Wednesday 05 September 2007 00:34, Mike Frysinger wrote:
> > +     kbd->dev = input_allocate_device();
> > ...
> > +     retval = input_register_device(kbd->dev);
> > +     if (unlikely(retval))
> > +             goto cleanup;
> > ...
> > +      cleanup:
> > +     kfree(kbd);
> > +     return -EINVAL;
>
> i'm not familiar with the input layer, but do you need to deallocate that
> input device if the register fails ?  if so, i guess dc_kbd_disconnect()
> would need tweaking too ...

No, dc_kbd_disconnect() is fine - the structure is refcounted and so
input core will free it when the last reference drops. But you are
right, input_free_device() is still needed in error path.

--
Dmitry