Commit 7d9b62ae authored by David Kozub's avatar David Kozub Committed by Jens Axboe

block: sed-opal: unify error handling of responses

response_get_{string,u64} include error handling for argument resp being
NULL but response_get_token does not handle this.

Make all three of response_get_{string,u64,token} handle NULL resp in
the same way.
Co-authored-by: default avatarJonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Signed-off-by: default avatarDavid Kozub <zub@linux.fjfi.cvut.cz>
Signed-off-by: default avatarJonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Reviewed-by: default avatarScott Bauer <sbauer@plzdonthack.me>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJon Derrick <jonathan.derrick@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e8b29224
......@@ -696,6 +696,11 @@ static const struct opal_resp_tok *response_get_token(
{
const struct opal_resp_tok *tok;
if (!resp) {
pr_debug("Response is NULL\n");
return ERR_PTR(-EINVAL);
}
if (n >= resp->num) {
pr_debug("Token number doesn't exist: %d, resp: %d\n",
n, resp->num);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment