can: peak_usb: fix cleanup sequence order in case of error during init
authorStephane Grosjean <s.grosjean@peak-system.com>
Fri, 28 Nov 2014 12:49:10 +0000 (13:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2015 14:59:00 +0000 (06:59 -0800)
commit5e5740524c3c8c4127d6e0eab62c619f6650e017
treefecd4d5c5365af7ed8e3712a12a0318927c1769e
parenta510bea7571d651562bbdc8fec6ce2725a2ad0ab
can: peak_usb: fix cleanup sequence order in case of error during init

commit af35d0f1cce7a990286e2b94c260a2c2d2a0e4b0 upstream.

This patch sets the correct reverse sequence order to the instructions
set to run, when any failure occurs during the initialization steps.
It also adds the missing unregistration call of the can device if the
failure appears after having been registered.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/can/usb/peak_usb/pcan_usb_core.c