diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2016-07-17 17:21:50 +0200 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2016-07-18 08:46:46 +0000 |
commit | 30710cce8f5c4babba0582bfa2ec751afa8e90b4 (patch) | |
tree | 5a8ee0bea98668ba7de70f1a3325ddfcae136139 /src/plugins/canbus/peakcan | |
parent | 0b0caa7b1ebcd72a520148fe2a36b92eab12610e (diff) |
PeakCAN: Do not close interface when open fails
Trying to close an interface that is not open leads
to errors which fill the internal error message buffer
with unrelated errors like "full write buffer".
Instead, the error should indicate that open failed.
As QCanBusDevice::connectDevice() already sets
UnconnectedState, this does not need to be done here.
Change-Id: I61c73c9d51e05eb5ea80a13e1c706e4a3eca98c0
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/plugins/canbus/peakcan')
-rw-r--r-- | src/plugins/canbus/peakcan/peakcanbackend.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/plugins/canbus/peakcan/peakcanbackend.cpp b/src/plugins/canbus/peakcan/peakcanbackend.cpp index 7d54e18..5b06007 100644 --- a/src/plugins/canbus/peakcan/peakcanbackend.cpp +++ b/src/plugins/canbus/peakcan/peakcanbackend.cpp @@ -493,10 +493,8 @@ bool PeakCanBackend::open() Q_D(PeakCanBackend); if (!d->isOpen) { - if (!d->open()) { - close(); // sets UnconnectedState + if (!d->open()) return false; - } // apply all stored configurations except bitrate, because // the bitrate can not be applied after opening of device |