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)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:05:41 +0000 (13:05 +0000)
commit83908aed2fe310bb7f54283b53f32d278b1221a5
tree49700ed0789e515beaf754ae6e743aefe3a08dd6
parent0a4671cde863ceec4b6f177a9e1f03a5c4bcd57b
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