]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
block/sed-opal: Propagate original error message to userland.
authorScott Bauer <scott.bauer@intel.com>
Wed, 22 Feb 2017 17:15:08 +0000 (10:15 -0700)
committerJens Axboe <axboe@fb.com>
Thu, 23 Feb 2017 18:55:44 +0000 (11:55 -0700)
During an error on a comannd, ex: user provides wrong pw to unlock
range, we will gracefully terminate the opal session. We want to
propagate the original error to userland instead of the result of
the session termination, which is almost always a success.

Signed-off-by: Scott Bauer <scott.bauer@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/sed-opal.c

index 020bf3e28e38db1869d29b72ed012aebda00530e..1e18dca360fc501033762d4c505c2e32c4674ee6 100644 (file)
@@ -396,8 +396,11 @@ static int next(struct opal_dev *dev)
                         * session. Therefore we shouldn't attempt to terminate
                         * a session, as one has not yet been created.
                         */
-                       if (state > 1)
-                               return end_opal_session_error(dev);
+                       if (state > 1) {
+                               end_opal_session_error(dev);
+                               return error;
+                       }
+
                }
                state++;
        } while (!error);