media: staging: lirc_serial: Fix init/exit order
authorBen Hutchings <ben@decadent.org.uk>
Wed, 16 Nov 2011 04:49:41 +0000 (01:49 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 12 Mar 2012 19:31:39 +0000 (12:31 -0700)
commit06b267b55cddb826dca2cc3b5eacc4ca760696f3
tree57e5e4f3d344c6fb0a41737bd80ee95384c956f7
parent261d612b2edcb3e8b00ad990b6b81c71e4a5d108
media: staging: lirc_serial: Fix init/exit order

commit 9105b8b200410383d0854bbe237ee385d7d33ba6 upstream.

Currently the module init function registers a platform_device and
only then allocates its IRQ and I/O region.  This allows allocation to
race with the device's suspend() function.  Instead, allocate
resources in the platform driver's probe() function and free them in
the remove() function.

The module exit function removes the platform device before the
character device that provides access to it.  Change it to reverse the
order of initialisation.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/lirc/lirc_serial.c